I am trying to convert the company FetchXML files into SQL code. when I came across this statement in FectchXML:
<condition attribute = "vcr_ambassador", operator="eq-userid">
Actually, I know it means to get the current user. Also, I have read some tutorial online and some stack overflow answers about it. But I am still confused. I am not sure if I can still run my SQL code without translating this operator. All I want is to compare the results from SQL with the results from FechXML. I dont really care about the current user.
Moreover, how does this "eq-userid" operator relate to the WHERE clause in SQL? If I don't translate this operator, does it affect the SQL result?
Couple of points:
Use filteredview
when you are converting into SQL queries, so the CRM security concepts will be still applied on your resultset
If you are planning to strip of this filter condition, your result will differ obviously because this is targeting a custom field - vcr_ambassador
You have to convert the condition like below:
WHERE vcr_ambassador = '<GUID>'
You can retreive GUID
like below:
select s.SystemUserId from SystemUserBase s where s.DomainName = SUSER_SNAME() --this gives GUID
select SUSER_SNAME() --this gives domain name
Ref: https://mahadeomatre.blogspot.com/2015/04/fetch-xml-condition-to-sql-where.html