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

DB connector not able to handle null value with ternary or if else need help

mbh_it1
New Contributor II
New Contributor II

Hello All,

I need to pass Null when CP6 of entitlementvalue is blank/null, however it is not working.

I tried following:

  1. Simple JSON, this works when CP6 is not null, for null it throws error: {
    "Role": [
    "insert into role (User_ID, Role_ID, Company_ID) values ('${user.customproperty27}','${task.entitlement_valueKey.customproperty5}', '${task.entitlement_valueKey.customproperty6}')"
    ]
    }
  2. following takes null but fails with actual value when goes to second condition, tried couple of combinations , not working.
  3. {
    "Role": [
    "insert into role (User_ID, Role_ID, Company_ID) values ('${user.customproperty27}','${task.entitlement_valueKey.customproperty5}', ${(task.entitlement_valueKey.customproperty6 == null || task.entitlement_valueKey.customproperty6 == '') ? 'NULL' : 'task.entitlement_valueKey.customproperty6' })"
    ]
  4. Tried following as well:{
    "Role": [
    "insert into role (User_ID, Role_ID, Company_ID) values ('${user.customproperty27}','${task.entitlement_valueKey.customproperty5}', '${arstasksObj?.entitlementvalueKey?.customproperty6}')"
    ]
    }

Thanks

Mahesh

1 REPLY 1

rushikeshvartak
All-Star
All-Star

{
"Role": [
"insert into role (UserID, RoleID, CompanyID) values ('${user.customproperty27}', '${task.entitlement_valueKey.customproperty5}', ${task.entitlement_valueKey.customproperty6 ? '${task.entitlement_valueKey.customproperty6}' : 'NULL'})"
]
}


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.