Click HERE to see how Saviynt Intelligence is transforming the industry. |
10/30/2023 03:04 AM - edited 10/30/2023 03:08 AM
Hi,
The below JSON is not able to generate the ticket for Jira Ticketing System.
As the "tasktype=2" for both the "Remove Access" and "Remove Account", how to mention the condition using 'If-Else' to check the 'Tasktype' and set the 'summary' field of Jira Ticket.
There is issue with the 'ID' field in the JSON, the "user.customproperty8" field is working fine.
In the JSON, I am checking for the "Remove Access" condition only. But I need to check for "Remove Account" type also. How to do the condition check in the query in the JSON below:
{
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://xxxxxx.net/rest/api/3/issue",
"httpMethod": "POST",
"httpParams": "{\"fields\": {\"project\":{\"key\":\"SP\"},\"summary\":\"${if(task.tasktype==1){'Add Access Ticket'}else if(task.tasktype==2 && task.entitlement_valuekey!==null){'Remove Access'}else if(task.tasktype==3){'Add Account Ticket'}else{'unknowtask'}}\",\"issuetype\": {\"name\": \"Task\"},\"reporter\":{\"id\": \"${user.customproperty8}\"}}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketidPath": "id",
"unsuccessResponses": {
"message": "Failed"
}
}
]
}
10/30/2023 03:31 AM
@Saviynt_Savvy Seem to be issue is with ticketidPath.
Try below mapping
"ticketidPath": "result.number",
Also attached the sample JSON with if -else condition.
If this reply answered your question, please Accept it As Solution to help others who may have a similar problem.
10/30/2023 03:41 AM
Hi Sumathi,
Thanks for response.
There is no issue with the 'ticketidPath' and it is the JIRA Ticketing System we are using, not the Service Now.
If I make simple condition check, like... "if (task.tasktype==2){'Remove Account'}", then it is working fine.
10/30/2023 03:48 AM
@Saviynt_Savvy can you share postman response?
10/31/2023 12:36 AM
10/31/2023 12:57 AM
Please share the error logs and you can use my attached json as a reference for if -else condition.