Click HERE to see how Saviynt Intelligence is transforming the industry. |
06/14/2023 07:11 AM
Hello,
I am trying to pass '' in else condition with below logicfor an attribute in createaccountjson. With this, the condition in else is always satisfied even if the entitlement name is matching. That means the json does not accept blank value. I tried {} but the target doesn't accept null value.
Is there a way to not send this attribute if there is no matching entitlement?
"Attribute1": "${if(arsTasks.entitlement_valueKey.entitlement_value!=null && (arsTasks.entitlement_valueKey.entitlement_value == 'ev1' || arsTasks.entitlement_valueKey.entitlement_value =='ev2' || arsTasks.entitlement_valueKey.entitlement_value =='ev3' || arsTasks.entitlement_valueKey.entitlement_value =='ev4')) {'entid'} else {''}}
06/14/2023 09:46 AM - edited 06/14/2023 09:47 AM
@piyushm you can use this to completely remove the "Attribute1" key from the JSON using this -
...
...
${if(arsTasks.entitlement_valueKey.entitlement_value!=null && (arsTasks.entitlement_valueKey.entitlement_value == 'ev1' || arsTasks.entitlement_valueKey.entitlement_value =='ev2' || arsTasks.entitlement_valueKey.entitlement_value =='ev3' || arsTasks.entitlement_valueKey.entitlement_value =='ev4')) {'"Attribute1": "entid",'} else {''}}
...
...
06/14/2023 10:37 AM
Hi @vivekmohanty_pm ,
I tried with above syntax. But still it is going to the else condition even for the 4 entitlements.
06/15/2023 06:33 AM
@piyushm can you share more details? maybe the logs where you are able to see this happening?
06/16/2023 07:28 AM
@vivekmohanty_pm - I don't see anything printed in the logs about the attributes in the createaccountjson. I have {"showLogs":true} in the customconfigjson.
06/16/2023 07:40 AM
@piyushm Can you tell me how you came to know that the flow is still going to the else condition even for the 4 entitlements?
Are you able to see it in the logs? Or in the target application?
06/16/2023 07:51 AM
I checked in target and the account is getting created with the entitlement but the attribute is not set. I also tried with dummy value in else condition like , else {'ABCDE'} and requesting one of the 4 entitlements. Then with this it works fine and sets the attribute with the value specified in the If condition.
06/16/2023 08:08 AM
@piyushm will it be possible for you to share the debug logs and the full JSON you are using from a sandbox environment?
06/16/2023 08:21 AM - edited 06/16/2023 08:42 AM
06/16/2023 08:37 AM - edited 06/17/2023 01:34 AM
@piyushm Can you try with this create account JSON?
Regards,
Vivek Mohanty
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem
06/16/2023 08:56 AM
@vivekmohanty_pm - Tried with the json above. Still it is not setting the attribute.
06/16/2023 09:30 AM
@vivekmohanty_pm - It is working with the new json that you shared. I was adding ',' after the 2nd last attribute thinking you missed it but looks like that is taken in this logic itself.
One last question. Does this also work for dynamic attribute? If a dynamic attribute is modified I don't want to pass profileid in the modifyaccountjson. The reason is as of now the update account task is getting executed last(even though there is a task execution hierarchy set, but its not working) and it overwrites the profileid being assigned from the Add Access task in the same request.
06/30/2023 03:56 PM
@vivekmohanty_pm Any thoughts or inputs on the previous question?
07/01/2023 11:15 PM - edited 07/01/2023 11:15 PM
@piyushm Yes this should be possible for dynamic attributes too as long as you are able to translate the logic in a groovy script in the JSON.