Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

what is the syntax for modifyuserjson in saviynt db connector?

theosveg
Regular Contributor II
Regular Contributor II

what is the syntax for modifyuserjson in saviynt db connector? is it even available to use? I am trying to preprocess user data, and am wondering if this is allowed.

13 REPLIES 13

Raghu
All-Star
All-Star

@theosveg 

https://forums.saviynt.com/t5/user-import/best-practice-for-inline-preprocessing/ta-p/35948

https://forums.saviynt.com/t5/identity-governance/username-and-systemusername-not-picking-up-from-gl...

 

Sample :

{
"ADDITIONALTABLES":
{
"USERS":"SELECT USERKEY,CUSTOMER,COMPANYNAME,COSTCENTER,JOBCODEDESC FROM USERS",
"CUSTOMER":"SELECT CUSTOMERKEY,CUSTOMERNAME FROM CUSTOMER"
},
"COMPUTEDCOLUMNS":
[
"CUSTOMER"
],
"PREPROCESSQUERIES":
[
"UPDATE NEWUSERDATA SET CUSTOMER = ( SELECT C.CUSTOMERNAME FROM CURRENTCUSTOMER C WHERE NEWUSERDATA.COMPANYNAME = C.CUSTOMERKEY)",
]
}


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.

PremMahadikar
All-Star
All-Star

Hi @theosveg ,

This is allowed!

General Format: Integration Options with the Saviynt Database (saviyntcloud.com)

PremMahadikar_1-1718903078113.png

Sample MODIFYUSERDATAJSON:

{ 
"ADDITIONALTABLES": { 
"USERS":"SELECT USERKEY,username,employeeid FROM USERS" }, 
"COMPUTEDCOLUMNS":[ 
"username",
"systemusername",
"manager" 
], 
"PREPROCESSQUERIES": [ 
"UPDATE NEWUSERDATA SET USERNAME = (CASE WHEN username = '' then CONCAT(employeeid,'tst') else CONCAT(username,'tst') END)", 
"UPDATE NEWUSERDATA SET SYSTEMUSERNAME = username", 
"UPDATE NEWUSERDATA SET manager = (select u.username from currentusers u where u.employeeid = manager LIMIT 1)"
] 
}

PremMahadikar_0-1718903031090.png

 

If this helps your question, please consider selecting Accept As Solution and hit Kudos

theosveg
Regular Contributor II
Regular Contributor II

what is the issue with this format below: 

I keep getting this error: Error in Users Import - Error while processing data: Unknown column 'TEMPUSERS_1610364.CUSTOMPROPERTY1' in 'field list'

{
"ADDITIONALTABLES": {
"USERS": "SELECT STATUSKEY, USERNAME, CUSTOMPROPERTY1 FROM USERS"
},
"COMPUTEDCOLUMNS": [
"STATUSKEY"
],
"PREPROCESSQUERIES": [
"UPDATE NEWUSERDATA SET STATUSKEY = CASE WHEN currentusers.CUSTOMPROPERTY1 = 'Active' THEN '1' ELSE '0' END WHERE USERNAME IN (SELECT USERNAME FROM currentusers)"
]
}

 

 

PremMahadikar
All-Star
All-Star

@theosveg ,

Try below, its working for me.

{
"ADDITIONALTABLES": {
"USERS": "SELECT STATUSKEY, USERNAME, CUSTOMPROPERTY1 FROM USERS"
},
"COMPUTEDCOLUMNS": [
"STATUSKEY"
],
"PREPROCESSQUERIES": [
"UPDATE NEWUSERDATA NEW, CURRENTUSERS CU SET NEW.STATUSKEY = CASE WHEN CU.CUSTOMPROPERTY1 = 'Active' THEN '1' ELSE '0' END WHERE NEW.USERNAME=CU.USERNAME"
]
}

  Please make sure - statuskey, username, customproperty1 are in your csv file.

 

If this helps your question, please consider selecting Accept As Solution and hit Kudos

theosveg
Regular Contributor II
Regular Contributor II

say, I want to update existing users and not while import, what would be the way to go?

@theosveg ,

  • If you are using Saviynt DB connector, configure Update User JSON with simple SQL query.

PremMahadikar_0-1718906990499.png

{
    "updateUserQry": [
        "UPDATE users u SET u.statuskey = 1 WHERE u.customproperty1='active' AND u.userkey = ${user.id};"]
  })
  • Configure a user update rule to match the condition of a user and action to trigger 'Create Update User Task'
  • You can run this rule via detective job to run for bulk users

 

If this helps your question, please consider selecting Accept As Solution and hit Kudos

theosveg
Regular Contributor II
Regular Contributor II

I am wondering if my approach is even valid, nothing happens after the task is created and moves to pending task, WSRETRY does nothing. If it helps, the user is updated from the UI through a form.

Task proceessing and modifyuserjson has nothing to do. Check if json is proper 

share logs


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

theosveg
Regular Contributor II
Regular Contributor II

here's what I am using, { "UpdateUserQry" :["Update users u1 set u1.statuskey = (case when u1.customproperty1 = 'Active' and u1.employeetype = 'ABC' and u1.userkey='${user.id}' then 1 else 0 end) where u1.userkey='${user.id}'" ]}.

 

Sav4Sav DB connector, task is created on user updated in UI, but nothing happens after... What exactly is the expected behavior?

Run WSRETRY for particular task and share logs


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

theosveg
Regular Contributor II
Regular Contributor II

thesvg_0-1718984300887.png

am I supposed to see nothing populated for endpoint, SS etc? update user tasks only allows the selection of a connection..

No . Run wsretry with task type as update user


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

PremMahadikar
All-Star
All-Star

@theosveg ,

  • Have a csv export for the users you want to update
  • Bulk user import using .csv file

If this helps your question, please consider selecting Accept As Solution and hit Kudos