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

REST - Unable to Process Null Value from User Attribute

Micky16
New Contributor III
New Contributor III
Hi,
 
I am trying to include some logic in the below field, but its not working and giving out 400 error.
It is working when i have tried to send an actual value in the user attribute.
 
There are 3 associated logics in the field called "Default Legal Entity":
 
1) if user is an employee and cp39 is present, then send the cp39 value => working
2) if user is not an employee, then send cp5 value => working
3) If user an employee and cp39 is null, then send blank value => failing
4)  if user is not an employee and cp5 is null, then send blank value => failing
 
my updateAccount json as follows:
 
{
 "accountIdPath": "accountName",
 "call": [{
  "name": "call1",
  "callOrder": "0",
  "connection": "acctAuth",
  "showResponse": true,
  "httpMethod": "POST",
  "httpParams": "{ \"headers\": { \"Type\" : \"User_Upload_Saviynt\"}, \"data\" : [ { \"Username\" : \"${user.systemUserName.toString().toLowerCase()}_BPFG\", \"First Name\": \"${user.firstname}\", \"Last Name\":\"${user.lastname}\", \"Email\":\"${user.email}\", \"Phone Number\": \"${user.phonenumber}\",\"Country\": \"${user.customproperty50}\",\"Role Name\":\"Fieldglass standard user (bp)\",\"Default Legal Entity\": \"${if(user.employeeclass?.contains('Employee') && user.customproperty39==null) {''} else if (user.employeeclass?.contains('Employee')){(user.customproperty39.length()>4)?user.customproperty39.substring(user.customproperty39.length()-4,user.customproperty39.length()):user.customproperty39} else {user.customproperty5==null?'':user.customproperty5}}\",\"Primary Supervisor Username\":\"${userManager.systemUserName}_BPFG\",\"Employee Id\":\"${user.systemUserName}\",\"[C] Entity\": \"${user.customproperty1==null?'':user.customproperty1} - ${user.customproperty2==null?'':user.customproperty2}\",\"[C] Sub Entity\": \"${user.customproperty3==null?'':user.customproperty3} - ${user.customproperty4==null?'':user.customproperty4}\",\"[C] Enterprise\": \"${user.departmentNumber==null?'':user.departmentNumber} - ${user.departmentname==null?'':user.departmentname}\",\"[C] Asset Region Structure\": \"${user.customproperty46==null?'':user.customproperty46} - ${user.customproperty47==null?'':user.customproperty47}\",\"[C] Asset Region Code\": \"${user.customproperty44==null?'':user.customproperty44} - ${user.customproperty45==null?'':user.customproperty45}\",\"[C] Asset Sub Region Code\": \"${user.customproperty48==null?'':user.customproperty48} - ${user.customproperty49==null?'':user.customproperty49}\"}]}",
  "httpHeaders": {
   "Authorization": "${access_token}",
   "Content-Type": "application/json/;charset=utf-8",
   "Accept": "application/json"
  },
  "httpContentType": "application/json",
  "successResponses": {
   "statusCode": [
    200,
    201
   ]
  },
  "unsuccessResponses": {
   "statusCode": [
    400,
    401,
    404,
    405
   ]
  }
 }]
}

 

Screenshot logs as attached
4 REPLIES 4

rushikeshvartak
All-Star
All-Star

Is it working using postman. Does api accepts blank value ? Screenshot from postman


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

Hi Rushikesh,

Thanks, we have tested via Postman and its working for create case only, not allowing on update case. Hence will remove implementation for update case.

This is for Internal Partner (contractor). It is working for Employee case now. Can you check if my Custom Property 5 condition is correct? 

1) if user is an employee and cp39 is present, then send the cp39 value => working
2) if user is not an employee, then send cp5 value => failing
3) If user an employee and cp39 is null, then send blank value => working
4)  if user is not an employee and cp5 is null, then send blank value => failing

Attribute Logic

\"Default Legal Entity\": \"${if(user.employeeclass?.contains('Employee') && user.customproperty39==null) {''} else if (user.employeeclass?.contains('Employee')){(user.customproperty39.length()>4)?user.customproperty39.substring(user.customproperty39.length()-4,user.customproperty39.length()):user.customproperty39} else {user.customproperty5==null?'':user.customproperty5}}\"

Try string function isNull() instead of ==


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

Micky16
New Contributor III
New Contributor III

Thanks Rushikesh.

Made some changes, both options "==" and isNull() is working.