本文介绍了将列动态添加到 Salesforce 报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要动态地向 Salesforce 报告添加列(基于特定条件).我打算用一个正在寻找我的条件的触发器来做到这一点.我的两个问题,

I need to add columns to a salesforce report dynamically(based on particular conditions). I'm planning to do this with a trigger that is looking for my conditions. My two questions,

  1. 是否可以为报告动态添加列?
  2. 我们可以根据时间间隔而不是数据库更新来安排触发器吗?

谢谢,BR马杜拉

推荐答案

我不知道从 Apex 操作报告的任何可能性.可以使用元数据 API(例如 Eclipse IDE 中使用的那个)检索和修改报告定义,但这意味着您必须使用 hacks,因为元数据 API 在 Apex 中不容易获得.

I'm not aware of any possibility to manipulate Reports from Apex. Report definitions can be retrieved and modified with Metadata API (the one used in Eclipse IDE for example) but that means you'd have to use hacks since Metadata API is not easily available in Apex.

这是一种已知问题",很多人已经研究过:

It's a kind of "known problem" and many people have already researched it:

  1. http://boards.developerforce.com/t5/Apex-Code-Development/Is-it-possible-to-call-Metadata-API-from-Apex-code-Getting-Error/td-p/119412
  2. https://github.com/financialforcedev/apex-mdapi - 看起来很有趣我会说
  3. https://salesforce.stackexchange.com/questions/1082/has-anyone-ever-successfully-invoked-the-metadata-api-from-within-apex
  1. http://boards.developerforce.com/t5/Apex-Code-Development/Is-it-possible-to-call-Metadata-API-from-Apex-code-Getting-Error/td-p/119412
  2. https://github.com/financialforcedev/apex-mdapi - looks really interesting I'd say
  3. https://salesforce.stackexchange.com/questions/1082/has-anyone-ever-successfully-invoked-the-metadata-api-from-within-apex

您真的认为某种动态报告"是满足业务需求的有效解决方案吗?我的意思是 - 如果用户在报告中添加了一些列,并且第二天报告定义将改变,他们的工作就会消失......

Do you really think that some kind of "dynamic report" is a valid solution for business need though? I mean - users would be confused if they added some columns to the report and next day the report definition will change wiping out their work...

至于另一个问题 - 您可能不应该使用触发器"这个词;) 如果您希望某个 Apex 以时间间隔运行,您应该查看作业调度(编写一个 实施计划) 然后您可以安排它在特定时间运行.无需特殊调整,作业甚至可以每小时触发一次.

As for the other question - you probably shouldn't use the word "trigger" ;) If you want some Apex to run in time intervals you should have a lookt at job scheduling (write a class that implements Schedulable) and then you can schedule it to run at specific times. Without special tweaking the job can fire even every hour.

当然,还有基于时间的工作流选项,可以执行字段更新并触发一些真正的触发器,但这是非常以数据为中心的 - 不能保证它会按时间间隔运行.

Of course there's also option of time-based workflows that would perform a field update and cause some real trigger to fire but that's very data-centric - no guarantees that it will run at time intervals.

这篇关于将列动态添加到 Salesforce 报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 02:25