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

saviynt "comments" field in createTicketJSON

xu
New Contributor II
New Contributor II

Hi experts, 

Need help finding the target field for feeding into createTicketJSON.

Currently, ${businessJustification} is used, but it may lack context. I'd like to include any additional comments, including manager approval comments etc. added in during the provisioning process.

I've seen the comments column in ars_requests stores this, but unsure how to parse into JSON. Any tips? Thanks in advance!

for context, current createTicketJSON: 

 

{
    "call": [{
            "name": "createTicket",
            "connection": "acctAuth",
            "url": (redacted),
            "httpMethod": "POST",
            "httpContentType": "application/json",
            "httpParams": "{\"serviceDeskId\": \"20\",\"requestTypeId\": \"266\",\"requestFieldValues\": {\"summary\":\"${endpoint.endpointname} Request\",\"description\": \"Email: ${user.email}\\\\n Entitlements:\\\\n ${allEntitlementsValues}\\\\n Endpoint: ${endpoint.endpointname}\\\\n Business Justification: ${businessJustification}\"}}",
            "ticketidPath": "issueKey",
            "httpHeaders": {
                "Authorization": "${access_token}"
            }
        }
    ]
}

 

Xu

[This message has been edited by moderator to merge reply comment]

4 REPLIES 4

PremMahadikar
Valued Contributor
Valued Contributor

Hi @xu ,

Can you try the below:

\\\\nBusiness Justification : '+(task.requestKey==null?'':task.requestKey?.comments?.replaceAll('<.*?>','').replaceAll('\\n','').replaceAll('\\r','').replaceAll('[^ -~À-ÿ]+','').replaceAll(new String('XFw='.decodeBase64()),new String('XFxcXA=='.decodeBase64())))

 

If this helps, please consider selecting Accept As Solution and hit Kudos

xu
New Contributor II
New Contributor II

Hi Prem, 

Thanks for your response - unfortunately this has now broken the Jira ticket generation, and Saviynt provides this error 

xu_0-1717139201112.png

The logs seem to show the payloads suddenly cut off: 

2024-05-31T17:04:20+10:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-7-tk5s9-ERROR

 

-Error in createNewServiceTicketcom.fasterxml.jackson.core.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value at [Source: {"serviceDeskId": "20","requestTypeId": "266","requestFieldValues": {"summary":"DEV TICKET - parse comments - IRESS Request","description": "Saviynt User ID: lfan\n Saviynt Request ID: 610605\n Email: lucina.fan-v@barrenjoey.com\n \n Entitlements:\n ADD :: Group : (BASIC+ADMIN (Test))\n Endpoint: IRESS\nBusiness Justification : '+(task.requestKey==null?'':task.requestKey?.comments?.replaceAll('<.*?>','').replaceAll('

 

CreateTicketJSON for reference: 

 

"httpParams": "{\"serviceDeskId\": \"20\",\"requestTypeId\": \"266\",\"requestFieldValues\": {\"summary\":\"DEV TICKET - parse comments - ${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}\\\\nBusiness Justification : '+(task.requestKey==null?'':task.requestKey?.comments?.replaceAll('<.*?>','').replaceAll('\\n','').replaceAll('\\r','').replaceAll('[^ -~À-ÿ]+','').replaceAll(new String('XFw='.decodeBase64()),new String('XFxcXA=='.decodeBase64())))", 

 

Raghu
Honored Contributor
Honored Contributor

@xu  try below

{
"httpParams": "{\"serviceDeskId\": \"20\",\"requestTypeId\": \"266\",\"requestFieldValues\": {\"summary\":\"DEV TICKET - parse comments - ${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}\\nBusiness Justification : \"+(task.requestKey==null?\'\':task.requestKey?.comments?.replaceAll('<.*?>','').replaceAll('\\n','').replaceAll('\\r','').replaceAll('[^ -~À-ÿ]+','').replaceAll(new String('XFw='.decodeBase64()),new String('XFxcXA=='.decodeBase64())))\"}"

 


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.

xu
New Contributor II
New Contributor II

Hi Raghu, 

Thank you and Prem kindly for your responses, it helped me to find @Darshanjain's answer on https://forums.saviynt.com/t5/identity-governance/passing-the-comments-and-justifications-as-an-attr... with this format:

${task.requestKey==null?'':task.requestKey?.comments?.replaceAll('<.*?>','').replaceAll('\\n','').replaceAll('\\r','').replaceAll('[^ -~À-ÿ]+','').replaceAll(new String('XFw='.decodeBase64()),new String('XFxcXA=='.decodeBase64()))}

For some reason, the other format without the ${} was running into errors.