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

CreateTicket JSON Binding Variables

afauquem
New Contributor III
New Contributor III

Hello,

I'm trying to retrieve some variables related to the roles/entitlements of the access request to be inserted in a ticket. Apart from the ${allEntitlementsValues} variable, I can't manage to communicate other entitlement-related variables such as ${entitlementValue.entitlementID}. Are these variables accessible in the CreateTicket JSON or only in the AddAccess / Remove Acccess JSON?

I'd like to communicate just the role / entitlement name and not the whole string of information contained in the ${allEntitlementsValues} variable.

Thanks

13 REPLIES 13

rushikeshvartak
All-Star
All-Star

${task?.entitlementValueKey?.entitlement_value}


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

It works with this synxtax {task?.entitlement_valueKey?.entitlement_value}

However, I get the value of the entitlement linked to a single task in the request (just as if I use the task.id variable, I get the id of one task in the request).
By using the taskIds variable, I can retrieve all the tasks ID in the request. Is there a similar way of retrieving the value of the entitlements that corresponds to each of the tasks in the query (without using the ${allEntitlementsValues} variable, which isn't very useful in my context - I don't want entitlement_types, for example) ?

I'm still trying to work out how to use ${task?.entitlement_valueKey?.entitlement_value} and apply it to each of the request's tasks. Do you have a solution? Is it possible?

My goal is to send the following blocks in my ticket:
"add": "entitlement1,entitlement2,entitlement3", "remove": "entitlement4,entitlement5"

Thank's

We have done like below

\"Summary\" : \"${if(task.tasktype==1){'Add Access'}else if(task.tasktype==2 && (allEntitlementsValues==null || allEntitlementsValues.isEmpty() || allEntitlementsValues=='')){'Delete Account'}else if(task.tasktype==2){'Remove Access'}else if(task.tasktype==3){'New Account'}else if(task.tasktype==6){'Enable Account'}else if(task.tasktype==12){'Update Account'}else if(task.tasktype==14){'Disable Account'}else{task.tasktype}} for ${endpoint.endpointname}\",


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

This doesn't address the problem.

Is it possible to obtain the names of the entitlements for each task in the request using the variable {task?.entitlement_valueKey?.entitlement_value} ? As it stands, this variable only returns the value of a task's entitlement and not for each task in the request.

If this isn't possible, I think I can transform the format of the ${allEntitlementsValues} variable using the replace() functions. However, I can't seem to apply this function to the variable. What is the correct syntax?

Darshanjain
Saviynt Employee
Saviynt Employee

Hi @afauquem 

Directly there is no variable for to take each individual task and print the variables, But you can try with below as shown below ( where it takes single task and mention all details )

Please explore this-

 

${if(taskIds != null && taskIds.size()>0){String result='';ArrayList arr = new ArrayList(taskIds); arr.eachWithIndex{ val, idx -> com.saviynt.ecm.task.ArsTasks.get(val)?.entitlement_valueKey!=null?result=result.concat(com.saviynt.ecm.task.ArsTasks.get(val)?.tasktype==1?'ADD:: ':com.saviynt.ecm.task.ArsTasks.get(val)?.tasktype==31?'Extend End Date :: ':'REMOVE :: ').concat(com.saviynt.ecm.task.ArsTasks.get(val)?.entitlement_valueKey!=null?com.saviynt.ecm.task.ArsTasks.get(val)?.entitlement_valueKey?.entitlementtypekey.entitlementname+' : ':'').concat(com.saviynt.ecm.task.ArsTasks.get(val)?.entitlement_valueKey?.entitlement_value).concat(' : Access Start Date - ' + com.saviynt.ecm.task.ArsTasks.get(val)?.requestAccessKey?.startdate).concat(' : Access End Date - ' + com.saviynt.ecm.task.ArsTasks.get(val)?.requestAccessKey?.enddate).concat(' : Approved By - ' + com.saviynt.ecm.identitywarehouse.domain.Users.get(com.saviynt.ecm.task.ArsTasks.get(val)?.requestAccessKey?.collect{it.ae.findAll{it.jbpmActivityName.toString().equalsIgnoreCase('OwnerApproval')}}?.collect{it.approveby}.get(0).get(0)).displayname).concat('\\\\n'):'';}; return result}else{return '';}}

 

Thanks

Darshan

afauquem
New Contributor III
New Contributor III

Hi @Darshanjain,

Thank you for this payload. I understand the logic but as it stands it doesn't work. So I'm trying to use it step by step and I have a few questions.

I did the following test: 1 access request with 2 add access and 1 remove access with this httpparams.

"httpParams":"{\"entitlement\":\"${if(taskIds != null && taskIds.size()>0){String result='';ArrayList arr = new ArrayList(taskIds); arr.eachWithIndex{ val, idx ->result=result.concat(com.saviynt.ecm.task.ArsTasks.get(val)?.tasktype==1?'ADD: ':com.saviynt.ecm.task.ArsTasks.get(val)?.tasktype==2?'REMOVE: ':com.saviynt.ecm.task.ArsTasks.get(val));}; return result}else{return '';}}\"}",

However, I can't get the values back with :com.saviynt.ecm.task.ArsTasks.get(val). With this payload i send this json : 

{"entitlement":"ADD: ADD: REMOVE: "}

As you can see, the com.saviynt.ecm.task.ArsTasks.get(val)?.tasktype==1? works because it detects 2 add accesses and 1 remove access, so it retrieves the values for each task.

What correct  syntax should I use to display the values of these variables?

Thanks

Hi @afauquem 

What do you mean by However, I can't get the values back with :com.saviynt.ecm.task.ArsTasks.get(val)?

Are you looking to display the ent values inside the entitlements with add and remove and want it to be separtely displayed. can you give more clear and may be an example of what you want.

 

Thanks

Darshan

afauquem
New Contributor III
New Contributor III

Hi @Darshanjain 

Exactly, I want to display ent values separately like this : 

{ "ADD":"ent_value1,ent_value2,ent_value3",
  "REMOVE":"ent_value4,ent_value5"}

I try this to test but it doesn't display the ent values :

"httpParams":"{\"ADD\":\"${if(taskIds != null && taskIds.size()>0){String result='';ArrayList arr = new ArrayList(taskIds); arr.eachWithIndex{ val, idx ->result=result.concat(com.saviynt.ecm.task.ArsTasks.get(val)?.tasktype==1?:com.saviynt.ecm.task.ArsTasks.get(val)?.entitlement_valueKey?.entitlement_value);}; return result}else{return '';}}\"}",

Do you have any idea to display the ent_values of each task in the create ticket JSON without the ${allEntitlementsValues} variables which hasn't good format in my case ?

Thanks

Hi @afauquem 

Can you please use this variable

com.saviynt.ecm.task.ArsTasks.get(val)?.entitlement_valueKey?.entitlementtypekey.entitlementname

 

Thanks

Darshan 

afauquem
New Contributor III
New Contributor III

I have the same issue, it doesn't displays the value. 

Hi @afauquem 

Even one ent value is not being displayed?

The variable is correct? what is it printing in the logs

 

Thanks

Darshan

afauquem
New Contributor III
New Contributor III

Hi @Darshanjain ,

No ent value display, I have no errors. With the query below, it returns just the string "ADD" due to the condition tasktype==1 : {"entitlement":"ADD: ADD: "}

"httpParams":"{\"entitlement\":\"${if(taskIds != null && taskIds.size()>0){String result='';ArrayList arr = new ArrayList(taskIds); arr.eachWithIndex{ val, idx ->result=result.concat(com.saviynt.ecm.task.ArsTasks.get(val)?.tasktype==1?'ADD: ':com.saviynt.ecm.task.ArsTasks.get(val)?.entitlement_valueKey?.entitlement_value);}; return result}else{return 'nok';}}\"}",

I attach the logs.

Thanks

 

afauquem
New Contributor III
New Contributor III

Hi everyone,

I'm sharing with you a solution that works to retrieve the value of each entitlement in the CreateTicketJSON part.

"httpParams":"{\"request_id\":\"${requestid}\"${if(taskIds != null && taskIds.size()>0){String result='';String result2='';String resultat3='';ArrayList arr = new ArrayList(taskIds);arr.eachWithIndex{val, idx ->com.saviynt.ecm.task.ArsTasks.get(val)?.tasktype==1?result=result.concat('{\"name\":\"'+com.saviynt.ecm.task.ArsTasks.get(val)?.entitlement_valueKey?.entitlement_value+'\"},'):com.saviynt.ecm.task.ArsTasks.get(val)?.tasktype==2?result2=result2.concat('{\"name\":\"'+com.saviynt.ecm.task.ArsTasks.get(val)?.entitlement_valueKey?.entitlement_value+'\"},'):'';};if (result.length()!=0){result=',\"roles_add\":['+result.substring(0, result.length() - 1)+']';};if(result2.length()!=0){result2=',\"roles_remove\":['+result2.substring(0, result2.length() - 1)+']';};if (result.length()!=0 && result2.length()!=0){result3=result+result2;}else {result3=result+result2;};return result3;}else{return '';}}}",