首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过Salesforce API获取Salesforce中属于报表的所有线索

通过Salesforce API获取Salesforce中属于报表的所有线索
EN

Stack Overflow用户
提问于 2021-09-08 14:17:28
回答 1查看 157关注 0票数 1

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

你好啊

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

我正在开发的系统需要查询Salesforce的线索。它还需要过滤从Salesforce询问的线索的能力。与其在我们项目的一侧构建过滤功能,不如利用Salesforce中的Report's,这样用户就有了他们可以使用的最佳筛选选项(那些由Salesforce维护的)。水流会像这样:

用户在Salesforce中创建一个报告,该报表返回一个引线列表。用户登录到项目X并从其Salesforce account.

  • Project X中已经存在的报表列表中选择一个报告,然后可以通过Salesforce API.

获取所选报告返回的所有线索。

我已经找到了从Salesforce API获取线索或报告的文档。但是,我还没有找到任何解释如何返回特定报告返回的线索的方法。

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

谢谢!

EN

回答 1

Stack Overflow用户

发布于 2022-06-12 10:56:46

它现在看起来很受支持。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是一个同步端点,您可以使用它来获取所需的内容。下面是一个响应有效负载示例。您在请求行-> dataCells。reportExtendedMetadata包含缓存所需的所有高级元数据细节。

代码语言:javascript
复制
{
  "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就能得到你想要的所有报告。

注意:

possible

  • According
  • 使用最新的API版本达到极限,每个实例每小时只有500个同步调用。这可能对你的项目是好的。只是在外面打电话。我不会在这个答案中写下异步版本,因为它有很多步骤。
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69104788

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档