通过Salesforce API获取属于Salesforce报告的所有潜在客户



这个问题在2013年问过,据说不支持。我希望它在过去的8年里得到了支持…

大家好

我是Salesforce生态系统/API的新手,在处理我的项目(项目X)的以下需求时遇到了一些麻烦。

我正在使用的系统需要从Salesforce查询Leads。它还需要能够过滤从Salesforce查询的Leads。与其在我们的项目中构建过滤功能,不如在Salesforce中使用Report功能,这样用户就可以获得最好的过滤选项(由Salesforce维护的选项)。流将是这样的:

  1. 用户在Salesforce中创建一个报告,该报告返回一个潜在客户列表。
  2. 用户登录到项目X并从已经存在于其Salesforce帐户中的报表列表中选择一个报表。
  3. 然后,Project X能够通过Salesforce API获取所选报告返回的所有lead。

我已经能够找到从Salesforce API获取lead或报告的文档。但是,我没有找到任何解释如何返回由特定报告返回的Leads的内容。

任何帮助/指导将不胜感激。

谢谢!

看起来现在支持了。https://developer.salesforce.com/docs/atlas.en-us.api_analytics.meta/api_analytics/sforce_analytics_rest_api_get_reportdata.htm

总结,/services/data/v35.0/analytics/reports/00OR0000000K2UeMAK?includeDetails = true是一个同步端点,您可以使用它来获得您所要求的内容。下面是一个示例响应有效负载。你要的是Rows ->datacell。reportExtendedMetadata包含所有高级元数据细节,用于缓存。

{
"attributes" : {     
"describeUrl" :
"/services/data/v35.0/analytics/reports/00OR0000000K2UeMAK/describe",     
"instancesUrl" :
"/services/data/v35.0/analytics/reports/00OR0000000K2UeMAK/instances",     
"reportId" :
"00OR0000000K2UeMAK",     
"reportName" : "Deals Closing This Quarter",     
"type" : "Report" 
},   
"allData" : true,   
"factMap" : {     
"2!0_0" : {       
"aggregates" : [ 
{ "label" : "$16,000.01", "value" : 16000.010000000000218278728425502777099609375 }, 
{ "label" : "$16,000.01", "value" : 16000.010000000000218278728425502777099609375 }, 
{ "label" : "1", "value" : 1 } ],       
"rows" : [ {         
"dataCells" : [ 
{ "label" : "Acme - 200 Widgets", "value" : "006R00000023IDYIA2" }, 
{ "label" : "$16,000.01",           
"value" : { "amount" : 16000.01, "currency" : null } }, 
{ "label" : "Word of mouth", "value" : "Word of mouth" }, 
{ "label" : "Need estimate", "value" : "Need estimate" }, 
{ "label" : "60%", "value" : 60}, 
{ "label" : "Q3-2015", "value" : "Q3-2015" }, 
{ "label" : "12", "value" : 12 }, 
{ "label" : "7/31/2015", "value" : "2015-07-31" }, 
{ "label" : "Fred Wiliamson", "value" : "005R0000000Hv5rIAC" }, 
{ "label" : "-", "value" : null } ]       
} ]     
},     
"T!0" : {
"aggregates" : [ 
{ "label" : "$32,021.01", "value" : 32021.00999999999839928932487964630126953125 }, 
{ "label" : "$16,010.51", "value" : 16010.504999999999199644662439823150634765625 }, 
{ "label" : "2", "value" : 2 } ],       
"rows" : [ ]      
},    
...    
"T!T" : {
"aggregates" : [ 
{ "label" : "$153,042.01", "value" : 153042.01000000000931322574615478515625 }, 
{ "label" : "$25,507.00", "value" : 25507.00166666666700621135532855987548828125 }, 
{ "label" : "6", "value" : 6 } ],       
"rows" : [ ]     
},
...
"groupingsAcross" : { 
"groupings" : [ 
{ 
"groupings" : [ 
{ "groupings" : [ ], "key" : "0_0", "label" : "Existing Business", "value" : "Existing Business" } ],       
"key" : "0",       
"label" : "July 2015",       
"value" : "2015-07-01"
}, 
{ 
"groupings" : [ 
{ "groupings" : [ ], "key" : "1_0", "label" : "Existing Business", "value" : "Existing Business" }, 
{ "groupings" : [ ], "key" : "1_1", "label" : "New Business", "value" : "New Business" } ],       
"key" : "1",       
"label" : "August 2015",       
"value" : "2015-08-01"
}, 
{       
"groupings" : [ 
{ "groupings" : [ ], "key" : "2_0", "label" : "Existing Business", "value" : "Existing Business" } ],       
"key" : "2",       
"label" : "September 2015",       
"value" : "2015-09-01"     
} 
]   
},   
"groupingsDown" : {
"groupings" : [ 
{ "groupings" : [ ], "key" : "0", "label" : "Acme", "value" : "001R0000002GuzsIAC" }, 
{ "groupings" : [ ], "key" : "1", "label" : "Facebook", "value" : "001R0000001nUAmIAM" }, 
{ "groupings" : [ ], "key" : "2", "label" : "Home Depot", "value" : "001R0000002Gv5zIAC" }, 
{ "groupings" : [ ], "key" : "3", "label" : "Mircosoft", "value" : "001R0000002Gv5QIAS" } ]   
},
"hasDetailRows" : true,   
"reportExtendedMetadata" : { 
"aggregateColumnInfo" : {
"s!AMOUNT" : {         
"acrossGroupingContext" : null,         
"dataType" : "currency",         
"downGroupingContext" : null, 
"label" : "Sum of Amount" },       
"a!AMOUNT" : {         
"acrossGroupingContext" : null,         
"dataType" : "currency",         
"downGroupingContext" : null,         
"label" : "Average Amount" },       
"RowCount" : {         
"acrossGroupingContext" : null,         
"dataType" : "int",         
"downGroupingContext" : null,         
"label" : "Record Count" }
},     
"detailColumnInfo" : {       
"OPPORTUNITY_NAME" : { "dataType" : "string", "label" : "Opportunity Name" },       
"AMOUNT" : { "dataType" : "currency", "label" : "Amount" },       
"LEAD_SOURCE" : { "dataType" : "picklist", "label" : "Lead Source" },       
"NEXT_STEP" : { "dataType" : "string", "label" : "Next Step" },
"PROBABILITY" : { "dataType" : "percent", "label" : "Probability (%)" },       
"FISCAL_QUARTER" : { "dataType" : "string", "label" : "Fiscal Period" },       
"AGE" : { "dataType" : "int", "label" : "Age" },       
"CREATED_DATE" : { "dataType" : "datetime", "label" : "Created Date" },       
"FULL_NAME" : { "dataType" : "string", "label" : "Opportunity Owner" },       
"ROLLUP_DESCRIPTION" : { "dataType" : "string", "label" : "Owner Role" }     
},
"groupingColumnInfo" : {       
"ACCOUNT_NAME" : { "dataType" : "string", "groupingLevel" : 0, "label" : "Account Name" },       
"CLOSE_DATE" : { "dataType" : "date", "groupingLevel" : 0, "label" : "Close Date" },       
"TYPE" : { "dataType" : "picklist", "groupingLevel" : 1, "label" : "Type" }     
}   
},   
"reportMetadata" : {     
"aggregates" : [ "s!AMOUNT", "a!AMOUNT", "RowCount" ],     
"chart" : { 
"chartType" : "Donut",
"groupings" : [ "CLOSE_DATE" ],       
"hasLegend" : true,       
"showChartValues" : false,       
"summaries" : [ "s!AMOUNT" ],       
"summaryAxisLocations" : [ "Y" ],
"title" : "Pipeline by Stage and Type"
},     
"currency" : null,     
"description" : null,     
"detailColumns" : [ "OPPORTUNITY_NAME", "AMOUNT", "LEAD_SOURCE","NEXT_STEP", 
"PROBABILITY", "FISCAL_QUARTER", "AGE", "CREATED_DATE", "FULL_NAME", "ROLLUP_DESCRIPTION" ],  
"developerName" : "Deals_Closing_This_Quarter",
"division" : null,     
"folderId" : "00lR0000000M8IiIAK",     
"groupingsAcross" : [ 
{ "dateGranularity" : "Month", "name" : "CLOSE_DATE", "sortAggregate" : null, "sortOrder" : "Asc"}, 
{ "dateGranularity" : "None", "name" : "TYPE", "sortAggregate" : null, "sortOrder" : "Asc" } ],
"groupingsDown" : [ 
{ "dateGranularity" : "None", "name" : "ACCOUNT_NAME", "sortAggregate" : null, "sortOrder" : "Asc" } ],
"hasDetailRows" : true,     
"hasRecordCount" : true,     
"historicalSnapshotDates" : [ ],     
"id" : "00OR0000000K2UeMAK",     
"name" : "Deals Closing This Quarter",
"reportBooleanFilter" : null,     
"reportFilters" : [ 
{ "column" : "BucketField_36625466", "isRunPageEditable" : true, "operator" : "equals", "value" : "Early,Late" }, 
{ "column" : "TYPE", "isRunPageEditable" : true, "operator" : "equals", "value" : "Existing Business,New Business" } ],     
"reportFormat" : "MATRIX",     
"reportType" : { "label" : "Opportunities", "type" : "Opportunity" },     
"scope" : "organization",
"showGrandTotal" : true,
"showSubtotals" : true,
"sortBy" : [ ],
"standardDateFilter" : { 
"column" : "CLOSE_DATE", 
"durationValue" : "THIS_FISCAL_QUARTER", 
"endDate" : "2015-09-30", 
"startDate" : "2015-07-01" },     
"standardFilters" : [ 
{ "name" : "open", "value" : "all" }, 
{ "name" : "probability", "value" : ">0" } ]   
}
}

你需要得到一份报告列表。/services/data/v35.0/analytics/reports显示最近查看的5个。或者你知道,你只需要使用SOQL来获取你想要的所有报告。

注意:

  • 尽可能使用最新的API版本
  • 根据限制,每个实例每小时只能进行500次同步调用。这对你的项目来说可能没问题。只是在外面喊而已。我没有把异步版本在这个答案,因为它的一堆步骤。

相关内容

  • 没有找到相关文章

最新更新