且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将列动态添加到 Salesforce 报表

更新时间:2023-11-30 22:54:16

我不知道从 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.