Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Copy CustomPropertyX from EndpointA to CustomPropertyX on EndpointB using customquery

RV
Regular Contributor
Regular Contributor

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.

5 REPLIES 5

Enakshi
Saviynt Employee
Saviynt Employee

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 = '');

RV
Regular Contributor
Regular Contributor

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.

RV
Regular Contributor
Regular Contributor

And this update query should only work on all the users having Accounts A and B.

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'


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

RV
Regular Contributor
Regular Contributor

Thanks Rushi.  Will give it a try.