本文介绍了请求的资源在Salesforce中不存在[错误].Salesforce有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我执行SOQL请求以获取SObject'ObjectPermissions'的所有可用记录ID.然后,我使用请求 GET/services/data/v48.0/sobjects/ObjectPermissions/{id} 来获取特定记录的所有必要信息.如您在第一张图片中所看到的,我收到了包含960条记录的回复.问题是我无法获得285个条目的信息.这是我收到的285个答案中的一个示例:我突出显示了该记录的标识符.也许这个ID是错误的.

I execute a SOQL request to get all available record ids of the SObject 'ObjectPermissions'.Then I use the request to GET /services/data/v48.0/sobjects/ObjectPermissions/{id} to fetch all the necessary info for a specific record.As you can see in the first picture, I received a response with a total of 960 records.The problem is that for 285 entries I can’t get the information.Here is an example of the answer I received for one of 285:I highlighted the identifier of this record. Maybe this id is wrong.

我观察到以下SObjects相同:

I observe the same with the following SObjects:

TaskStatus
TaskPriority
解决方案状态
PartnerRole
OrderStatus
FlowDefinitionView
现场安全分类EntityDefinition
ContractStatus
CaseStatus

我可以在具有常规对象(例如,事件,任务和LoginHistory)的不同Salesforce组织上观察到相同的行为.但是这种行为并不总是在每个组织中都可以重现.

Salesforce是在做错什么还是我听不懂?

Is Salesforce doing something wrong or I do not understand something?

推荐答案

根据您的错误描述和屏幕截图,我认为您正在通过编程方式(Apex,Python,Java ...)进行操作,没有时间了您的第一个请求(提取数据,/Query?q =),响应与第二个请求(基于ID,/sobjects/ObjectPermissions/{id}的记录的详细信息)之间的延迟

Based on your error description and screenshot, I assume that you're doing it through programetically ( Apex, Python, Java...) and there is no time delay between your first request(extraction of data, /Query?q=) , response and the second request (details of the record based on ID, /sobjects/ObjectPermissions/{id})

  1. 具有'000'的记录可以在Salesforce中标识为 EmptyKeys ,并且通常引用空关系值.
  1. The records with '000' can be idntified as EmptyKeys in Salesforce and generally refers to null relationship values.

联系人是机会"上的查找字段,下面的查询将返回相同的计数.

Contact is the lookup field on Opportunity and below queries will return the same count.

SELECT count() FROM opportunity WHERE contactId = null
SELECT count() FROM Opportunity WHERE contactId = '000000000000000AAA'
  1. 关于对象"权限中的记录(以'000'开头),与Empty键几乎没有什么不同,可以在博客中找到ID的细分
  1. In reference to the records in Object permission (starting with '000'), is little different from Empty keys and breakdown of the ids can be found in the blog

Salesforce密钥背后的奥秘前缀'000'

  1. 在上述情况下,我们无法在Metadata API查询中过滤掉这些对象,但是我们可以在发送APEX代码中的第二个请求之前过滤记录.

设置responseIds-从第一个请求返回的响应记录ID,并处理该ID以过滤出"000"个ID用于第二个请求.

Set responseIds - Response record Ids returned from First Request and process the Ids to filter out '000' Ids for second request.

String prefix = Schema.SobjectType.ObjectPermissions.getKeyPrefix();
for(String str : responseIds){
    if(!str.subString(0,3).contains(prefix)){
        responseIds.remove(str);
    }
}
  1. RecentlyViewed对象不能直接使用.该对象中的ID不是属于最近查看的对象的ID,而是实际记录的ID.因此,如果您打算从该对象访问记录,则需要从最近查看的对象中获取ID,然后解码键前缀以获取正确的sObject名称,然后以这种方式使用它/sobjects/{decodedSobjectName}/{ID}

或者,您也可以使用/services/data/v48.0/recent(有关详细信息,请参阅Salesforce文档)

Or alternatively you can use /services/data/v48.0/recent (refer Salesforce documentation for details)

https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_recent_items.htm

  1. 尽管每个标准选择列表都有单独的对象,但是它们都共享相同的keyprefix/objectType.以下代码将删除所有针对选择列表对象(Taskstatus,Casestatus,解决方案状态...)的请求

  1. Although we have separate object for each standard picklist, they all share same keyprefix/objectType. The following code will remove all the request which are directed towards picklist objects (Taskstatus, Casestatus, solution status...)

for(Id str : responseIds){
     if(Id.getsobjecttype() == 'Picklistmaster'){
         responseIds.remove(str);
     }
 }

  • 至于登录历史记录,6个月之后的记录将由salesforce在内部删除.因此,如果您运行2请求(查询请求,以后的数据请求)并且如果这2请求恰好位于Salesforce维护窗口之间,则在您的第二个请求期间,所引用的ID已从组织中删除,因此会出现错误.并确保您具有管理用户"权限.

  • As for Loginhistory, the records later than 6 months will be deleted internally by salesforce. So if you run the 2 request (Query request, later data request) and if this 2 request happens to lie between the Salesforce maintenance window, then during your second request the id referred is already deleted from the org, hence the error. And make sure you have Manage Users permissions.

    这篇关于请求的资源在Salesforce中不存在[错误].Salesforce有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

  • 08-18 11:52