04/27/2023 04:23 AM
We are trying to add the if else condition for the Subject line in our ticketing tool. We are trying to change the subject line based on the action taken in the ARS page.
The JSON we are using is:
{
"call":[
{
"name":"call1",
"connection":"acctAuth",
"url":"xxxxxx",
"httpMethod":"POST",
"httpParams":"{\"ticket\":[{\"eeid_c\":\"${if(task?.tasktype==3){user.employeeid} else{'Dummy'}}\",\"Subject\":\"${if(task?.tasktype==3){endpoint?.customproperty1} else{endpoint?.customproperty2}} ${user.firstname} ${user.lastname}\", \"Description\":\"${endpoint?.customproperty2}\", \"Cust_Type_c\":\"${endpoint?.customproperty3}\", \"Item_c\":\"${endpoint?.customproperty4}\", \"Cust_Category_c\":\"${endpoint?.customproperty5}\"}]}",
"httpHeaders":{
"Authorization":"${access_token}",
"Accept":"application/json"
},
"httpContentType":"application/json",
"ticketidPath":"CaseNumber",
"successResponses":{
"statusCode":[
200,
201
]
}
}
]
}
This is throwing error and we are unable to find out why. Please help us to resolve this issue.
Solved! Go to Solution.
04/27/2023 06:30 AM
Hi @PRATYUSH1
Instead of using if else, try to use the ternary operators in createticket json,
Example for one expression for above would be-
${(task.tasktype == 3) ? user.employeeid : 'Dummy'}
Thanks
Darshan
05/03/2023 11:17 PM
@PRATYUSH1 please refer below sample :
{\"short_description\":\"${if(task.source=='PROVRULE' && task?.tasktype==14){'[NO ACTION REQUIRED]:'} else if(task.tasktype==14){'[NO ACTION REQUIRED]:'} else if(task.requestKey?.requesttype==3 || task.requestKey?.requesttype==11 && task.tasktype==3){''}else if(task.tasktype==2 && (allEntitlementsValues==null || allEntitlementsValues.isEmpty() || allEntitlementsValues=='')){''}else if(task.source=='PROVRULE' && task?.tasktype==2){''}else if(task.tasktype==2){''}else if(task.requestKey?.requesttype != 3 && task?.tasktype==1){''}else if(task.tasktype==6){''}else if(task.tasktype==12){''}else{task.tasktype}}