How to do a Salesforce query using apache camel related to the field CreatedDate?

喜你入骨 提交于 2021-02-11 12:50:51

问题


I am doing a salesforce query to fetch certain records based on conditions imposed on the field ID and CreatedDate using apache camel. This is the toD statement

.toD("salesforce:query?sObjectQuery=Select Id, Name, CreatedDate from Account where Id > '' and CreatedDate > 2019-01-03T12:12:27.000+0000 order by CreatedDate, Id limit 10&rawPayload=true")

This returns this error response

org.apache.camel.component.salesforce.api.SalesforceException: {errors:[{"errorCode":"MALFORMED_QUERY","message":"\nCreatedDate > 2019-01-03T12:12:27.0000000 order by CreatedDate, Id limit\n                                        ^\nERROR at Row:1:Column:101\nline 1:101 no viable alternative at character ' '","fields":null}],statusCode:400}

Looks like it is ignoring the + in the Created Date. How do I solve this problem?


回答1:


Expected date & Datetime formats are here: https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_dateformats.htm

Dot for milliseconds is not accepted and if you don't need timezone - drop the part with "+" too. Zulu time is closest to what you have, go with 2019-01-03T12:12:27Z ?



来源:https://stackoverflow.com/questions/63081281/how-to-do-a-salesforce-query-using-apache-camel-related-to-the-field-createddate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!