简体   繁体   English

SalesForce SOQL查询用户

[英]SalesForce SOQL Query Users

We are using Jitterbit to sync user between SalesForce and NetSuite, we are doing this with an endpoint that takes in the query parameters of Id which is working but i also want to sync all users if the url query parameter is not present. 我们正在使用Jitterbit在SalesForce和NetSuite之间同步用户,我们通过一个端点执行此操作,该端点接收正在运行的Id的查询参数,但是如果URL查询参数不存在,我也想同步所有用户。 The reason for this is to sync all users once a day. 这样做的原因是每天同步所有用户一次。

So this is the query that i am using 所以这是我正在使用的查询

SELECT Id, City, Email, FirstName, IsActive,  LastModifiedDate, LastName, Phone, PostalCode, State, Street ,Country 
FROM User 
WHERE LastModifiedDate = TODAY AND (Id != null or Id =  '[SFDCID]')

How can I write the query to pull all users when Id is not in the URL string but still continue to pull just the one record when the SFDCID is present in the url string? 当Id不在URL字符串中时,我如何编写查询以拉出所有用户,而当URL字符串中出现SFDCID时,仍然继续仅拉出一条记录?

Two different simple SOQL queries must be switched in your application. 必须在您的应用程序中切换两个不同的简单SOQL查询

SELECT ... FROM User WHERE LastModifiedDate = TODAY AND Id =  '[SFDCID]'
SELECT ... FROM User WHERE LastModifiedDate = TODAY

This is due to restrictions of SOQL language, because the expression on the left side of the elementar SOQL fieldExpression must be a field of the object, not a constant. 这是由于SOQL语言的限制,因为基本SOQL fieldExpression左侧的表达式必须是对象的字段,而不是常量。

What you did want is approximately this (That is now allowed in SOQL. You can not compare a constant to constant.) 您想要的大概就是这个(SOQL 现在允许 。您不能将常量与常量进行比较。)

WHERE LastModifiedDate = TODAY AND (Id = '[SFDCID]' OR '[SFDCID]' = '')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM