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

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 you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.