08/09/2022 06:29 PM
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?
Solved! Go to Solution.
08/09/2022 08:14 PM
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+''}}"]} |
08/09/2022 08:31 PM
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
08/09/2022 08:54 PM
Yes
\"TargetAttribute\":\"${if{reqAttrs.customproperty5=='Sales'}{'Yes'} else {'NA'}}\"
Customproperty5 is account column for dynamic attribute
08/09/2022 09:18 PM
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.
08/09/2022 09:40 PM
08/09/2022 10:30 PM
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\"}'}"
08/09/2022 10:48 PM
Thanks. Its helpful
11/24/2022 05:10 AM
Is it possible to apply condition on the left side attributes?
Example:
"${(userId.equals(username))? '' : {systemUserName}}" : "${(userId.equals(username))? '' :{username~#~char}}",