本文介绍了如何使用Apex在SalesForce中以编程方式访问报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在SalesForce平台上编写一个应用程序,该应用程序可以从报告中提取联系人列表并将其发送到Web服务(例如向他们发送电子邮件或SMS)

I'm trying to write an app on the SalesForce platform that can pull a list of contacts from a report and send them to a web service (say to send them an email or SMS)

我似乎可以找到的唯一方法是将报告结果添加到新创建的广告系列中,然后访问该广告系列.这似乎很漫长.

The only way I can seem to find to do this is to add the report results to a newly created campaign, and then access that campaign. This seems like the long way around.

我在网上阅读的每一篇帖子都说您无法通过Apex访问报告,但是大多数或所有这些帖子都是在上个月发布API版本20之前编写的,API版本20引入了一个新的报告对象.现在,我可以以编程方式访问有关报告的信息(例如上次运行的日期等),但似乎仍然找不到找到该报告中包含的结果数据的方法.

Every post I read online says you can't access the reports through Apex, however most or all of these posts were written before Version 20 of the API was released last month, which introduced a new report object. I can now programmatically access info about a report (Such as the date last run etc) but I still can't seem to find a way to access the result data contained in that report.

有人知道有没有办法做到这一点?

Does anyone know if there's a way to do that?

推荐答案

经过大量研究,我发现目前唯一的方法确实是抓取CSV文档.我想康加等正在使用这种方法.

After much research into it, I've discovered the only way to do this at the moment is indeed to scrape the CSV document. I would guess that Conga etc are using exactly this method.

我们已经进行了一段时间了,并且有效.唯一的警告是:

We've been doing this for a while now, and it works. The only caveats are:

  • Salesforce用户名/密码/安全令牌必须共享给该应用程序正在连接.如果密码更改(默认情况下,它已更改每30天左右)令牌也更改,必须重新输入.

  • Salesforce username / password /security token has to be shared tothe app connecting. If the passwordchanges (and by default it is changedevery 30 days or so) the token alsochanges and must be re-entered.

您必须知道帐户的托管人,这可能很难正确.例如,尽管大多数欧洲帐户都会使用emea.salesforce.com访问CSV,但即使我们位于以下国家/地区,我们的帐户也使用na7(北美7)爱尔兰.我目前正在将页面托管发送给应用并进行解析计算要使用的正确子域,但我认为必须有一个更好的方法.

You have to know the host of the account, which can be difficult toget right. For instance while most european accounts would use emea.salesforce.com to access CSV, our account uses na7 (North America 7) even though we're located inireland. I'm currently sending the page host to the app and parsing itto calculate the correct subdomain to use, but I think there has to be abetter way to do this.

Salesforce确实需要通过提供一个API调用来解决此问题,该调用允许动态导出自定义报告结果,并允许我们使用OAuth进行连接.但是,当然,这不太可能发生.

Salesforce really needs to sort this out by supplying an API call which allows custom report results to be exported on the fly and allowing us to use OAuth to connect to it. But of course, this is unlikely to happen.

这篇关于如何使用Apex在SalesForce中以编程方式访问报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 20:57