You need to sign in to do that
Don't have an account?
F Smoak
cannot retrieve user ids having specific territory names in dev console query editor
I am trying to retrieve user IDs which do not belong to those territories whose names starts with IT_CH, but getting error "Unknown error parsing query" in dev console query editor.
Please note I need to use this as a single query and not via executing a class having for loops traversing from Territory to UserTerritory to User:
Select Id from User where Id in (Select UserID from UserTerritory where NOT TerritoryID.name LIKE 'IT_CH%'))
Please help.
Please note I need to use this as a single query and not via executing a class having for loops traversing from Territory to UserTerritory to User:
Select Id from User where Id in (Select UserID from UserTerritory where NOT TerritoryID.name LIKE 'IT_CH%'))
Please help.
UserTerritory -> UserTerritory2Association
TerritoryId.name -> Territory2.Name
Also, that "Unknown error parsing query" is coming from that extra ) at the very end of your query.
Try the following:
UserID from UserTerritory where NOT TerritoryID.name LIKE 'IT_CH%')
^
ERROR at Row:1:Column:77
Didn't understand relationship 'TerritoryID' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
I did try with User2Territoryassociation earlier but I got below error:
where Id in (Select UserID from UserTerritory2Association where
^
ERROR at Row:1:Column:53
sObject type 'UserTerritory2Association' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
Could you plese help solve this?
In Developer Console, try File > Open Resource > UserTerritory and screenshot it to see what fields there are.
This Query will actually be a part one of where clause of my original lengthy query hence I will require this as soql query :(