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

SQL server DB connector

TV
New Contributor
New Contributor

can we have multiple insert statement in createaccount JSON . each insert statement is for different tables.Let me know if any one tried

 

 

10 REPLIES 10

nimitdave
Saviynt Employee
Saviynt Employee

Yes, you can multiple the queries with semi colon

TV
New Contributor
New Contributor

like below??

{"createaccountqry": "insert into users (id,displayname,email,empid,firstname,lastname,systemname,username,password) values (${user.id}, '${user.displayname}', '${user.email}', '${user.employeeid}', '${user.firstname}','${user.lastname}','${user.systemusername}', '${user.username}','${randompassword}')";"insert into users (id,displayname,email,empid,firstname,lastname,systemname,username,password) values (${user.id}, '${user.displayname}', '${user.email}', '${user.employeeid}', '${user.firstname}','${user.lastname}','${user.systemusername}', '${user.username}','${randompassword}')"}

is this correct syntax? 

Looks to be correct.

Thanks

Thanks,
Devang Gandhi
If this reply answered your question, please Accept As Solution and give Kudos to help others who may have a similar problem.

nimitdave
Saviynt Employee
Saviynt Employee

like this:

{
"createaccountqry": "insert into users (id,displayname,email,empid,firstname,lastname,systemname,username,password) values (${user.id}, '${user.displayname}', '${user.email}', '${user.employeeid}', '${user.firstname}','${user.lastname}','${user.systemusername}', '${user.username}','${randompassword}');insert into users (id,displayname,email,empid,firstname,lastname,systemname,username,password) values (${user.id}, '${user.displayname}', '${user.email}', '${user.employeeid}', '${user.firstname}','${user.lastname}','${user.systemusername}', '${user.username}','${randompassword}')"
}

TV
New Contributor
New Contributor

Its not working,

I tried like above

and below

{"createaccountqry":"INSERT IGNORE INTO fim.Objects(object_id,object_type,display_name,app_id,role_name) values (‘${user.username}’, ‘user’, '${user.displayname}’, NULL, NULL)";
"INSERT IGNORE INTO fim.Attributes(object_id,attribute_name,string_value) values (‘${user.username}’, ‘location’, '${user.location}’)”}

both are failing with error parsing the JSON

TV
New Contributor
New Contributor

Tried taking out the queotes for values , still the same error

This is JSON issue.

Please try below:

{
"createaccountqry": "INSERT IGNORE INTO fim.Objects (object_id,object_type,display_name,app_id,role_name) values ('${user.username}', 'user', '${user.displayname}', 'NULL','NULL');INSERT IGNORE INTO fim.Attributes(object_id,attribute_name,string_value) values ('${user.username}', 'location', '${user.location}')"
}

Also use JSON validator in order to make sure that JSON is valid.

https://jsonlint.com/

 

dgandhi_0-1682634323639.png

Thanks

Thanks,
Devang Gandhi
If this reply answered your question, please Accept As Solution and give Kudos to help others who may have a similar problem.

You are using wrong single quote


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

Wondering why would we need to have quotes around the values that we fetch from user object 

1. ${user.username}. i dont think it requires quotes

2. However i did both kept the quotes and removed the quotes . only change is the error

Exception occurred in insert 163279-Exception occured while Excecuting Query

TV
New Contributor
New Contributor

Thanks guys i got it working ... am doubting on IGNORE ...for SQL server