Click HERE to see how Saviynt Intelligence is transforming the industry. |
06/03/2024 10:15 AM
Hi All,
I am creating a Ticket in the Freshservice application,
I need to put a value based on the Tasktype. Like, if the tasktype is not New Account task then I need to pass the string and a user attribute.
I am using ${task.tasktype!==3 ? 'Attribute Name'+user.customproperty5 : ''}.
But after running the Job, I couldn't provision the Ticket to "Pending Provision" state and couldn't create the Ticket.
I could see the error in logs mentioned as "Error in createNewServiceTicketcom.fasterxml.jackson.core.JsonParseException: Unrecognized token '$': was expecting ('true', 'false' or 'null')| at [Source:"
How to check the tasktype is not equal condition in Ticket JSON.
Any suggestions!
Thanks & Regards,
SaviyntSavvy
Solved! Go to Solution.
06/03/2024 10:33 AM
Can you share full json.
06/03/2024 11:10 AM
Hi @rushikeshvartak
Thank you for the response. Please take a look at the JSON below.
Create Ticket JSON:
{
"call":[
{
"name":"call1",
"connection":"acctAuth",
"url":"https://abcdefghj.freshservice.com/api/v2/tickets",
"httpMethod":"POST",
"httpParams":"{\"subject\":\"${((task.tasktype==3) && task.source=='ZERODAY') ? 'Joiner'+' '+user.firstname+' '+user.lastname:(task.tasktype==2 && task.source=='PROVRULE') ? 'Leaver'+' '+user.firstname+' '+user.lastname:''}\",\"email\":\"${task.endpoint.customproperty1}\",\"description\":\"<div><strong>Preferred Name : </strong>${user.displayname}</div></div><div><strong>Job Title : </strong>${user.title}</div><div><strong>${((task.tasktype!==3) && task.endpoint.endpointname=='Freshservice') ? 'Employee RIM-':''}</strong>${((task.tasktype!==3) && task.endpoint.endpointname=='Freshservice') ? user.username:''}</div><div><strong>Email :</strong> ${user.email}</div>\",\"priority\": 1, \"status\": 2}",
"httpHeaders":{
"contentType":"application/json",
"Authorization":"${access_token}"
},
"httpContentType":"application/json",
"ticketidPath":"ticket.id",
"unsuccessResponses":{
"message":"Failed"
}
}
]
}
Thanks & Regards,
SaviyntSavvy
06/03/2024 11:19 AM
{
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://abcdefghj.freshservice.com/api/v2/tickets",
"httpMethod": "POST",
"httpParams": "{\"subject\":\"${((task.tasktype==3) && task.source=='ZERODAY') ? 'Joiner ' + user.firstname + ' ' + user.lastname : (task.tasktype==2 && task.source=='PROVRULE') ? 'Leaver ' + user.firstname + ' ' + user.lastname : ''}\",\"email\":\"${task.endpoint.customproperty1}\",\"description\":\"<div><strong>Preferred Name : </strong>${user.displayname}</div><div><strong>Job Title : </strong>${user.title}</div><div><strong>${(task.tasktype!==3 && task.endpoint.endpointname=='Freshservice') ? 'Employee RIM-' : ''}</strong>${(task.tasktype!==3 && task.endpoint.endpointname=='Freshservice') ? user.username : ''}</div><div><strong>Email :</strong> ${user.email}</div>\",\"priority\": 1, \"status\": 2}",
"httpHeaders": {
"contentType": "application/json",
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketidPath": "ticket.id",
"unsuccessResponses": {
"message": "Failed"
}
}
]
}
06/03/2024 12:53 PM
Hi @rushikeshvartak
Still showing the same error in the LOGS.
Any other way to mention the !== condition in the JSON.
Thanks & Regards,
SaviyntSavvy
06/03/2024 06:46 PM
You can use if else logic
refer sample https://docs.saviyntcloud.com/bundle/ServiceNow-v24x/page/Content/ServiceNow-as-a-Ticketing-System.h...