本文介绍了使用 REST API 更新和删除 Salesforce 中的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

ax1.salesforce.com/services/data/v29.0/sobjects/Account/updated/?start=2015-06-30T06%3A49%3A00%2B00%3A00&end=2015-06-30T16%3A30%3A26%2B00%3A00

ax1.salesforce.com/services/data/v29.0/sobjects/Account/updated/?start=2015-06-30T06%3A49%3A00%2B00%3A00&end=2015-06-30T16%3A30%3A26%2B00%3A00

这似乎是一个典型的更新查询和删除查询也将类似以上

This seems to be a typical update query and delete query will also be similarto the above

此查询的响应将采用以下形式:

The response for this query will be of the form:

"ids": [ "0019000001QeOINAA3" ], "latestDateCovered": "2015-06-30T09:00:00.000+0000" }

"ids": [ "0019000001QeOINAA3" ], "latestDateCovered": "2015-06-30T09:00:00.000+0000" }

这里的主要问题是latestDateCovered参数:

The main problem here is latestDateCovered Parameter:

由于以下链接中提到的原因,它没有返回确切的时间:

It doesn't return the exact time due to the reasons mentioned in the following link:

https://help.salesforce.com/apex/HTViewSolution?id=000199029&language=en_US

因此,我可以使用 LastModifiedDate 参数来更新如下内容:https:///ap1.salesforce.com/services/data/v30.0/query?q=select%20LastModifiedDate%2CName%20from%20Account%20Where%20LastModifiedDate>2015-07-01T10%3A04%3A00.000%2B0000

so instead of this can I use LastModifiedDate parameter to update something like this:https://ap1.salesforce.com/services/data/v30.0/query?q=select%20LastModifiedDate%2CName%20from%20Account%20Where%20LastModifiedDate>2015-07-01T10%3A04%3A00.000%2B0000

我存储 lastModifiedDate 参数(所有记录中最高的)并执行相同的操作

I store the lastModifiedDate parameter(highest of all records) and do the same

两个查询都会产生相同的结果

Both the queries will yield the same results right

事实上,第二个提到的结果更好

Infact the secondly mentioned one gives better results

我可以继续吗?

会有什么问题吗?

推荐答案

您可能希望将帐户的 Id 添加到您的 SOQL 查询中,以获取与 getUpdated() 的 REST 等效项类似的数据复制 API 调用.

You would want to add Id of the Account to you SOQL query to get similar data to the REST equivalent of the getUpdated() replication API call.

阅读LastModifiedDate 和 SystemModStamp 有什么区别?.您可能会发现 SystemModStamp 更合适.

Have a read of What is the difference between LastModifiedDate and SystemModStamp?. You may find the SystemModStamp to be more appropriate.

来自 为什么 GetUpdatedResult.latestDateCovered 长时间不更新或更改时间?您链接到的文章.

From the Why is GetUpdatedResult.latestDateCovered not updating or changing for long periods of time? article that you link to.

"如果 Salesforce 在您的实例上执行长时间运行的事务,则此字段中的值是该长时间运行的事务的开始时间,直到它完成.这是因为长时间运行的事务可能会影响您的用户数据(例如例如,批处理)."

因此,Salesforce 将返回一个保守的latestDateCovered,以允许可能尚未完成的交易.

So, Salesforce is returning a conservative latestDateCovered to make allowances for transactions that may not have completed yet.

这两种方法的适用性取决于您计划对结果进行何种处理.如果您只想监控在较短时间段内发生变化的记录,您可能还需要考虑 Streaming API.例如.用户会话.

How suitable either approach is will depend on what exactly you are planning to do with the results. You might also want to consider the Streaming API if you only want to monitor records that are changing over a shorter period of time. E.g. a user session.

顺便说一下,Salesforce StackExchange 站点是询问 Salesforce 特定问题的好地方.

By the way, the Salesforce StackExchange site is a great place to ask Salesforce specific questions.

这篇关于使用 REST API 更新和删除 Salesforce 中的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 11:56