Click HERE to see how Saviynt Intelligence is transforming the industry. |
06/05/2024 07:39 PM - edited 06/05/2024 08:31 PM
Hi Experts,
Saviynt provisioning comments can be parsed through to a Jira ticket via the CreateTicketJSON, as below:
Comments: ${task.requestKey==null?'':task.requestKey?.comments?.replaceAll('<.*?>','').replaceAll('[\\\\x0A\\\\x0D]', ' ').replaceAll('[^ -~À-ÿ]+','').replaceAll(new String('XFw='.decodeBase64()),new String('XFxcXA=='.decodeBase64()))}\"}
{
"call":[
{
"name":"createTicket",
"connection":"acctAuth",
"url":"[URL]",
"httpMethod":"POST",
"httpContentType":"application/json",
"httpParams":"{\"serviceDeskId\":\"20\",\"requestTypeId\":\"266\",\"requestFieldValues\":{\"summary\":\"DEV TICKET please ignore - ${endpoint.endpointname} Request\",\"description\":\"Saviynt User ID: ${user.username}\\\\n Saviynt Request ID: ${requestid}\\\\n Email: ${user.email}\\\\n \\\\n Entitlements:\\\\n ${allEntitlementsValues}\\\\n Endpoint: ${endpoint.endpointname}\\\\n Comments: ${task.requestKey==null?'':task.requestKey?.comments?.replaceAll('<.*?>','').replaceAll('[\\\\x0A\\\\x0D]', ' ').replaceAll('[^ -~À-ÿ]+','').replaceAll(new String('XFw='.decodeBase64()),new String('XFxcXA=='.decodeBase64()))}\"}}",
"ticketidPath":"issueKey",
"httpHeaders":{
"Authorization":"${access_token}"
}
}
]
}
the function .replaceAll('[\\\\x0A\\\\x0D]', ' ') is to ensure the JSON is not broken by a line feed + carriage return. This obviously removes the line feed + carriage return, resulting in something similar as below, which is a bit difficult to read:
I am hoping that the line break entered before the words "NEW LINE" can be retained by means of something similar to .replaceAll('[\\\\x0D]', '\\\\n') (this did not work), and if possible, have a line break between the different user's comments?
Ideally, I would like the above output to look something like this:
Comments: [04-Jun-2024 03:52:22 UTC -User(username)] please let this ticket work NEW LINE to see if it can be parsed into Jira with spaces [04-Jun-2024 04:03:06 UTC -User(username)] test [04-Jun-2024 04:03:27 UTC -User(username)] test |
Please let me know if this is feasible.
Thank you in advance!
06/06/2024 07:39 AM
@xu try double slash
Comments: ${task.requestKey==null?'':task.requestKey?.comments?.replaceAll('<.*?>','').replaceAll('[\\\\x0A\\\\x0D]', '\\n').replaceAll('[^ -~À-ÿ]+','').replaceAll(new String('XFw='.decodeBase64()),new String('XFxcXA=='.decodeBase64()))}\"}
06/09/2024 10:15 PM