We are delighted to share our new EIC Delivery Methodology for efficiently managing Saviynt Implementations and delivering quick time to value. CLICK HERE.

Conditional provisioning JSOn - Create/Update

ejeong
Valued Contributor
Valued Contributor

Hi all,

I am wondering if we an implment "if-else" condition to use different JSON based on users.employeeType

 

if employeeType is Regular Then take this JSON

else take this JSON.

Is it feasible? if so, can anyone share me sample JSON for this?

8 REPLIES 8

rushikeshvartak
All-Star
All-Star

This is feasible 

DA_PROFILE,ACCOUNTTYPE - is Dynamic attribute name

{ "CreateAccountQry": [ "${if(ACCOUNTTYPE.isEmpty()) { 'CREATE USER '+accountName+' FOR LOGIN ['+accountName+'] ' } }" ] }

 

{"UpdateAccountQry": ["${if((ACCOUNTTYPE.isEmpty())){'ALTER USER '+accountName+' PROFILE  '+DA_PROFILE+''} else {'ALTER USER '+accountName+' PROFILE  '+DA_PROFILE+''}}"]}

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

Hi 

Could you please confirm if this is feasible for REST connection?

We want to use entire different attribute to be pased based on employeeType

Yes 

\"TargetAttribute\":\"${if{reqAttrs.customproperty5=='Sales'}{'Yes'} else {'NA'}}\"

Customproperty5 is account column for dynamic attribute


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

Thanks for reply again.

What i want is

If employeeType == full time

{Attribute1 : abc,

Attribute2: abc}

Else if employeeType == contractor

{Attribute1 : dfg,

Attribute2: dgf}

Can i do like this? Not only one attribute.

You can join two values using + operator 

 


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

KirtiAjrot
Saviynt Employee
Saviynt Employee

Instead of if -else , you could also make use of the ternary operator in the REST Jsons 

see below - we can use condition in URL too.. 

"url": "${(arsTasks.source.equalsIgnoreCase('PROVRULE'))?'https://iam22.ssmcloud.net/ECM/api/v5/completetask':'https://api.test.it.abc.com/provisoning'}",
"httpMethod": "POST",
"httpParams": "${arsTasks.source.equalsIgnoreCase('PROVRULE')? '{\"taskid\":\"'+arsTasks.id+'\",\"provisioning\": \"true\"}' : '{\"requestId\":\"\",\"taskId\":\"'+arsTasks.id+'\",\"requestType\":\"REMOVE\",\"provisionedDate\":\"'+new Date().toInstant()+'\",\"approveDate\":\"'+new Date().toInstant()+'\",\"firstName\":\"'+user.firstname+'\",\"lastName\":\"'+user.lastname+'\",\"alias\":\"'+user.systemUserName+'\",\"email\":\"'+user.email+'\",\"gin\":\"'+user.username+'\",\"requestorAlias\":\"\",\"accessType\":\"Automated\"}'}"

KA

ejeong
Valued Contributor
Valued Contributor

Thanks. Its helpful

Is it possible to apply condition on the left side attributes?

Example:

"${(userId.equals(username))? '' : {systemUserName}}" : "${(userId.equals(username))? '' :{username~#~char}}",