英文:
How to do a Salesforce query using apache camel related to the field CreatedDate?
问题
我正在执行Salesforce查询,根据对字段ID
和CreatedDate
施加的条件,使用Apache Camel获取特定记录。这是toD
语句:
.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")
这会返回以下错误响应:
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}
看起来它忽略了Created Date中的+
。我该如何解决这个问题?
英文:
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
得分: 0
预期日期和日期时间格式在此处:https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_dateformats.htm
不接受毫秒的点号,如果不需要时区,请删除带有“+”的部分。 Zulu 时间是最接近您所拥有的时间,是否使用 2019-01-03T12:12:27Z ?
英文:
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 ?
专注分享java语言的经验与见解,让所有开发者获益!
评论