更新和使用REST API在Salesforce中删除记录 [英] Updating and Deleting Records in Salesforce using REST API

查看:1663
本文介绍了更新和使用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

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

此查询的响应将是下面的形式:

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

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

它并不确切的时间返回,由于在下面的链接提到的原因:

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

所以不是这个,我可以使用LastModifiedDate参数更新是这样的:
<一href=\"https://ap1.salesforce.com/services/data/v30.0/query?q=select%20LastModifiedDate%2CName%20from%20Account%20Where%20LastModifiedDate\" rel=\"nofollow\">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参数(最高所有记录),做同样的

这两个查询会产生相同的结果正确

逸岸次述人给更好的结果。

我可以用相同的权利继续?

会不会有什么问题?


解决方案

您可能希望将帐户编号添加到您SOQL查询来获取类似数据的REST相当于getUpdated()复制API调用的。

有无的读<一href=\"https://developer.salesforce.com/blogs/engineering/2014/11/force-com-soql-performance-tips-systemmodstamp-vs-lastmodifieddate-2.html\"相对=nofollow>是什么LastModifiedDate和SystemModStamp区别?。您可能会发现SystemModStamp是比较合适的。

为什么GetUpdatedResult.latestDateCovered没有更新或更改长时间时间?文章,您链接到。


  

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


所以,Salesforce的返回一个保守的 latestDateCovered 来体谅这可能尚未完成的事务。

如何适用两种方法是将取决于正是你正在计划与结果有关。您可能还需要考虑的流API,如果你只想要监听正在改变在一段较短的时期记录。例如。用户会话。<​​/ P>

顺便说一句,在 Salesforce的StackExchange网站是一个伟大的地方,要求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

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

The response for this query will be of the form:

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

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

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

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

I can proceed with the same right?

will there be any problem?

解决方案

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.

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

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

"If Salesforce executes a long-running transaction on your instance, the value in this field is the start time of that long-running transaction until it completes. This is because a long-running transaction might affect your user data (for example, batch processing)."

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

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.

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

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆