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

REST: Skip the attribute in payload if null

shreyascn
New Contributor III
New Contributor III

Hello ,

I have a requirement where need to skip the attribute "Last_Working_Date__c" if the enddate of user is null. 

I dont want to change the entire payload using if else, rather looking for an alternative option within the payload to skip an attribute. 

When End date is present
"httpParams": "{\"Name\":\"${user.firstname}\",\"Last_Working_Date__c\":\"${user.enddate}\"}"

When End date is null
"httpParams": "{\"Name\":\"${user.firstname}\"}",


1 REPLY 1

SB
Saviynt Employee
Saviynt Employee

You will need to use if else clause in case an attribute needs to be skipped from the payload.

You can use Java operations to tweak any attributes by using if-else conditions, substrings, or operators in the JSON for provisioning. Below is an example you can refer to and construct your condition accordingly.

"Username": "${if(((user.departmentNumber!=account.customproperty23.substring(3,5)) && (user.customproperty30==account.customproperty27))||((user.departmentNumber==account.customproperty23.substring(3,5)) && (user.customproperty30!=account.customproperty27))){user.email+'.everest'} else if(((user.departmentNumber!=account.customproperty23.substring(3,5)) && (user.customproperty30!=account.customproperty27))|| user.customproperty3!=account.customproperty31||user.customproperty9=='Terminated'|| user.customproperty21=='ASAP'){user.email+'.everest'+'_'+Calendar.getInstance().getTime().format('yyyyMMdd')} else {user.email+'.everest'}}"


Regards,
Sahil