Click HERE to see how Saviynt Intelligence is transforming the industry. |
12/09/2022 10:04 AM
I have a usecase where I need to copy value from a CustomPropertyX from EndpointA to CustomPropertyX on EndpointB, only when CustomPropertyX on EndpointB is empty or NULL.
Can someone please provide update query to set custom property based on above use case? I am planning to run this periodically in a custom query.
12/09/2022 10:17 AM
Could you please check if the below query will solve the purpose?
UPDATE enpoints
SET
customproperty1 = (SELECT
customproperty1
FROM
endpoints
WHERE
endpointname = 'EndpointA')
WHERE
endpointname = 'EndpointB'
AND (customproperty1 IS NULL
OR customproperty1 = '');
12/09/2022 10:20 AM
I should have been more clearer. When I was referring to EndPointA, it is actually the account custompropertyX.
if user has two Accounts A, B and I need CustompropertyX from Account A to be updated to CustomPropertyX on Account B.
12/09/2022 10:22 AM
And this update query should only work on all the users having Accounts A and B.
12/09/2022 10:26 AM
UPDATE accounts a1 join endpoints e1 on e1.endpointkey=a1.endpointkey join user_accounts ua1 on ua1.accountkey=a1.accountkey SET
a1.customproperty1 = (SELECT a2.customproperty1 FROM endpoints e2,accounts a2,user_accounts ua2 WHERE e2.endpointname = 'EndpointB' and e2.endpointkey=a2.endpointkey and u2.userkey=a1.userkey)WHERE e1.endpointname = 'EndpointA'
12/09/2022 10:31 AM
Thanks Rushi. Will give it a try.