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

Logic for writing condition in JSON

Ravi
New Contributor
New Contributor

Hi,

I am writing the logic in createaccountJSON, getting the below error. Could someone suggest me the right logic.

"erp-compcode": "${ if (user.customproperty20=='TVN' || user.customproperty20=='Workday') {user.customproperty14 anyof ['249', '898', '888', '885', '766', '850', '849', '851', '852']}}",

While creating the AD Account got the below error.

Error while creating account in AD - No such property: anyof for class: SimpleTemplateScript11052

Thanks,

Ravi.

4 REPLIES 4

Dhruv_S
Saviynt Employee
Saviynt Employee

Please try with below. anyof method is not supported by code.

"erp-compcode": "${ if (user.customproperty20=='TVN' || user.customproperty20=='Workday') {user.customproperty14='249' || user.customproperty14='898' || user.customproperty14='888' || user.customproperty14='885' || user.customproperty14='766' || user.customproperty14='850' || user.customproperty14='849' || user.customproperty14='851' || user.customproperty14='852'}}",

Regards,

Dhruv Sharma

Ravi
New Contributor
New Contributor

Hi Dhruv,

I have tried the logic which was shared by you getting the below error.

"erp-compcode": "${ if (user.customproperty20=='TVN' || user.customproperty20=='Workday') {user.customproperty14=249 || user.customproperty14=898 || user.customproperty14=888 || user.customproperty14=885 || user.customproperty14=766 || user.customproperty14=850 || user.customproperty14=849 || user.customproperty14=851 || user.customproperty14=852}}",

Error while creating account in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript228.groovy: 39: (249 || user.customproperty14) is a binary expression, but it should be a variable expression at line: 39 column: 148. File: SimpleTemplateScript228.groovy @ line 39, column 148. '249' || user.customproperty14='898' || ^ 1 error

Thanks,

Ravi.

@Ravi : What is the actual if condition you are looking for? If user.customproperty14 is also your if condition then change the logic like below

"erp-compcode": "${ if (user.customproperty20=='TVN' || user.customproperty20=='Workday' || user.customproperty14=249 || user.customproperty14=898 || user.customproperty14=888 || user.customproperty14=885 || user.customproperty14=766 || user.customproperty14=850 || user.customproperty14=849 || user.customproperty14=851 || user.customproperty14=852){ <<logic when if condition is true>> }}",


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

Ravi
New Contributor
New Contributor

Hi Saathvik,

Customproperty20 or condition satisfied then print the customproperty14 to filter and print any of this number '249', '898', '888', '885', '766', '850', '849', '851', '852'.

Thanks,

Ravi.