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

Syntax to UPDATE DB Column based on Entitlement value of GRANTACCESSJSON

harishyara
Regular Contributor
Regular Contributor

Hello All,

We have a requirement to update users department column based on entitlement value.

In GRANTACCESSJSON of DB connection using below syntax but it is giving error

{
"Role" : [
"Update DBNAME.TABLENAME Set USERDEPT=CASE WHEN ${task.entitlement_valueKey.entitlement_value=='ROLE_USER'} THEN '' ELSE ${task.entitlement_valueKey.entitlement_value} END where USERID = '${task.accountName}'"
]
}

Error message - [SQL0199] Keyword THEN not expected. Valid tokens: < > = <> <= !< !> != >= ¬< ¬> ¬= IN NOT.

Please help me to fix this issue.

Thank you

3 REPLIES 3

armaanzahir
Valued Contributor
Valued Contributor

Hi @harishyara 

Can you try the below code and check if it works:

{
"Role" : [
"Update DBNAME.TABLENAME Set USERDEPT=CASE WHEN ${task.entitlement_valueKey.entitlement_value}='ROLE_USER' THEN '' ELSE ${task.entitlement_valueKey.entitlement_value} END where USERID = '${task.accountName}'"
]
}

Regards,
Md Armaan Zahir

Hello @armaanzahir I tried with your syntax still throwing same error.

sk
All-Star
All-Star

 

@harishyara : Try below logic

 

{
"Role" : [
"Update DBNAME.TABLENAME Set USERDEPT=NULLIF(${task.entitlement_valueKey.entitlement_value},'ROLE_USER') where USERID = '${task.accountName}'"
]
}


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.