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

Service-now createticket issue

shivmano
Regular Contributor III
Regular Contributor III

Hi Team - 

I am using multiple calls in my service-now createticketjson and seeing an issue where the ticket gets created fine with all the requirement dynamic attributes that I am passing and also evaluating the conditions, but the task still stays in 'New' state instead of 'pending provision' with the error as below.

Error in getting Ticket Number. Response: {"result":{"sys_id":"da456de7879e8a108354646e8bbb35c8","number":"REQ0204620","request_number":"REQ0204620","parent_id":null,"request_id":"da456de7879e8a108354646e8bbb35c8","parent_table":"task","table":"sc_request"}}
 
As you can see the ticket number is created but still there is error as Error in getting Ticket Number and the task does not move to pending provision
 
Attached is the json. The issue I am facing is with the endpoints endpoint1 and endpoint2 . The error in log says parse error - Error in createNewServiceTicketcom.fasterxml.jackson.core.JsonParseException: Unrecognized token '$'
 
Just adding to this, whenever the DA 'action' has a value other than Onboarding, then the 'typeofaccess' DA is hidden, in which case the ticket creation works without any issue and the task moves to pending provision. issue is when this is not hidden in the ARS page 
 
((requestAccessAttributes.get('action').equals('Onboarding'))? '\\\\nType Of Access : '+requestAccessAttributes.get('typeofaccess'):'')
 
{
"call": [{
"name": "call1",
"connection": "userAuth",
"url": "XXXXX",
"httpMethod": "POST",
"httpParams": "${(task.source == 'REQUEST' && (task.endpoint.endpointname.equals('endpoint1') || task.endpoint.endpointname.equals('endpoint2')))?'{\"sysparm_quantity\":\"1\", \"variables\": {\"u_request_for\":\"'+user.firstname+' '+user.lastname+'\", \"u_email\":\"'+user.email+'\", \"u_assign_grp\":\"'+task.endpoint.customproperty6+'\", \"u_short_desc\":\"Requested for : '+user.firstname+' '+user.lastname+' \\\\nRequested by : '+requestor.firstname+' '+requestor.lastname+' \\\\nOpened by Saviynt\", \"u_desc\":\"Please take action for '+user.firstname+' '+user.lastname+' \\\\nEmail: '+user.email+ '\\\\nUser Name: '+user.username + '\\\\nApplication: '+task.endpoint.displayName + '\\\\nOrganization: '+requestAccessAttributes?.get('Organization')+((task.endpoint.endpointname.equals('CYT-Azure-Devops-Project-Access'))? '\\\\nProject : '+requestAccessAttributes?.get('project'):'') +' \\\\nType of Action: '+requestAccessAttributes?.get('action') + '\\\\nRole: '+requestAccessAttributes?.get('accessrole')+((requestAccessAttributes.get('action').equals('Onboarding'))? '\\\\nType Of Access : '+requestAccessAttributes.get('typeofaccess'):'') +' \\\\ncomments: '+task.requestKey.comments.replace('<span class=\"busjustformat\">','').replace('</span>','').replace('<br/>','').replace('\"','').replace('\\r\\n',' ').replace('\\n',' ').decodeHTML()+' \\\\nSaviynt Task # '+task.id+'\"}}':'{\"sysparm_quantity\":\"1\", \"variables\": {\"u_request_for\":\"'+user.firstname+' '+user.lastname+'\", \"u_email\":\"'+user.email+'\", \"u_assign_grp\":\"'+task.endpoint.customproperty6+'\", \"u_short_desc\":\"Request for Entitlement : '+allEntitlementsValues+' \\\\nRequested for : '+user.firstname+' '+user.lastname+' \\\\nOpened by Saviynt\", \"u_desc\":\"Please Provision Access to '+user.firstname+' '+user.lastname+' \\\\nEmail: '+user.email+'\\\\nUser Name: '+user.username+((task.endpoint.endpointname.equals('CYT-Signals'))? '\\\\nCountry : '+user.country:'') +' \\\\nApplication Entitlement : '+allEntitlementsValues+((task.endpoint.endpointname.equals('CYT-Bank-Portals'))? '\\\\nBank Account\/TCODE : '+requestAccessAttributes?.get('bankaccount'):'') +((task.endpoint.endpointname.equals('CYT-China-wechat-based-SCRM-system'))? '\\\\nBusiness Justification : '+requestAccessAttributes?.get('Justification'):'') +' \\\\nApproved by : '+userManager.email+' '+usermanager+' \\\\ncomments: '+task.requestKey.comments.replace('<span class=\"busjustformat\">','').replace('</span>','').replace('<br/>','').replace('\"','').replace('\\r\\n',' ').replace('\\n',' ').decodeHTML()+' \\\\nSaviynt Task # '+task.id+'\"}}'}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"ticketidPath": "result.number",
"ticketStatusPath": "result.state",
"ticketStatusValue": [
"Open", "OPEN", "open"
],
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
}]
}
 
Can you please advise 
 
Thank you
 
7 REPLIES 7

rushikeshvartak
All-Star
All-Star

requestAccessAttributes?.get('typeofaccess'


Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.

shivmano
Regular Contributor III
Regular Contributor III

Tried this @rushikeshvartak .even after removing typeofaccess from the json, I still get the json parse error

Share current json


Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.

shivmano
Regular Contributor III
Regular Contributor III

Here it is:

{
"call": [{
"name": "call1",
"connection": "userAuth",
"url": "XXXXX",
"httpMethod": "POST",
"httpParams": "${(task.source == 'REQUEST' && (task.endpoint.endpointname.equals('CYT-Azure-Devops-Project-Access') || task.endpoint.endpointname.equals('CYT-Azure-Devops-Azure-Repos')))?'{\"sysparm_quantity\":\"1\", \"variables\": {\"u_request_for\":\"'+user.firstname+' '+user.lastname+'\", \"u_email\":\"'+user.email+'\", \"u_assign_grp\":\"'+task.endpoint.customproperty6+'\", \"u_short_desc\":\"Requested for : '+user.firstname+' '+user.lastname+' \\\\nRequested by : '+requestor.firstname+' '+requestor.lastname+' \\\\nOpened by Saviynt\", \"u_desc\":\"Please take action for '+user.firstname+' '+user.lastname+' \\\\nEmail: '+user.email+ '\\\\nUser Name: '+user.username + '\\\\nApplication: '+task.endpoint.displayName + '\\\\nOrganization: '+requestAccessAttributes?.get('Organization')+((task.endpoint.endpointname.equals('CYT-Azure-Devops-Project-Access'))? '\\\\nProject : '+requestAccessAttributes?.get('project'):'') +' \\\\nType of Action: '+requestAccessAttributes?.get('action') + '\\\\nRole: '+requestAccessAttributes?.get('accessrole') + ' \\\\ncomments: '+task.requestKey.comments.replace('<span class=\"busjustformat\">','').replace('</span>','').replace('<br/>','').replace('\"','').replace('\\r\\n',' ').replace('\\n',' ').decodeHTML()+' \\\\nSaviynt Task # '+task.id+'\"}}':'{\"sysparm_quantity\":\"1\", \"variables\": {\"u_request_for\":\"'+user.firstname+' '+user.lastname+'\", \"u_email\":\"'+user.email+'\", \"u_assign_grp\":\"'+task.endpoint.customproperty6+'\", \"u_short_desc\":\"Request for Entitlement : '+allEntitlementsValues+' \\\\nRequested for : '+user.firstname+' '+user.lastname+' \\\\nOpened by Saviynt\", \"u_desc\":\"Please Provision Access to '+user.firstname+' '+user.lastname+' \\\\nEmail: '+user.email+'\\\\nUser Name: '+user.username+((task.endpoint.endpointname.equals('CYT-Signals'))? '\\\\nCountry : '+user.country:'') +' \\\\nApplication Entitlement : '+allEntitlementsValues+((task.endpoint.endpointname.equals('CYT-Bank-Portals'))? '\\\\nBank Account\/TCODE : '+requestAccessAttributes?.get('bankaccount'):'') +((task.endpoint.endpointname.equals('CYT-China-wechat-based-SCRM-system'))? '\\\\nBusiness Justification : '+requestAccessAttributes?.get('Justification'):'') +' \\\\nApproved by : '+userManager.email+' '+usermanager+' \\\\ncomments: '+task.requestKey.comments.replace('<span class=\"busjustformat\">','').replace('</span>','').replace('<br/>','').replace('\"','').replace('\\r\\n',' ').replace('\\n',' ').decodeHTML()+' \\\\nSaviynt Task # '+task.id+'\"}}'}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"ticketidPath": "result.number",
"ticketStatusPath": "result.state",
"ticketStatusValue": [
"Open", "OPEN", "open"
],
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
}]
}

{
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "XXXXX",
"httpMethod": "POST",
"httpParams": "${(task.source == 'REQUEST' && (task.endpoint.endpointname.equals('CYT-Azure-Devops-Project-Access') || task.endpoint.endpointname.equals('CYT-Azure-Devops-Azure-Repos'))) ? '{\"sysparm_quantity\":\"1\", \"variables\": {\"u_request_for\":\"${user.firstname} ${user.lastname}\", \"u_email\":\"${user.email}\", \"u_assign_grp\":\"${task.endpoint.customproperty6}\", \"u_short_desc\":\"Requested for : ${user.firstname} ${user.lastname} \\\\nRequested by : ${requestor.firstname} ${requestor.lastname} \\\\nOpened by Saviynt\", \"u_desc\":\"Please take action for ${user.firstname} ${user.lastname} \\\\nEmail: ${user.email}\\nUser Name: ${user.username} \\nApplication: ${task.endpoint.displayName} \\nOrganization: ${requestAccessAttributes?.get('Organization')}${(task.endpoint.endpointname.equals('CYT-Azure-Devops-Project-Access')) ? ' \\nProject : ${requestAccessAttributes?.get('project')}' : ''} \\nType of Action: ${requestAccessAttributes?.get('action')} \\nRole: ${requestAccessAttributes?.get('accessrole')} \\ncomments: ${task.requestKey.comments.replace('<span class=\"busjustformat\">','').replace('</span>','').replace('<br/>','').replace('\"','').replace('\\r\\n',' ').replace('\\n',' ').decodeHTML()} \\nSaviynt Task # ${task.id}\"}}' : '{\"sysparm_quantity\":\"1\", \"variables\": {\"u_request_for\":\"${user.firstname} ${user.lastname}\", \"u_email\":\"${user.email}\", \"u_assign_grp\":\"${task.endpoint.customproperty6}\", \"u_short_desc\":\"Request for Entitlement : ${allEntitlementsValues} \\\\nRequested for : ${user.firstname} ${user.lastname} \\\\nOpened by Saviynt\", \"u_desc\":\"Please Provision Access to ${user.firstname} ${user.lastname} \\nEmail: ${user.email}\\nUser Name: ${user.username}${(task.endpoint.endpointname.equals('CYT-Signals')) ? ' \\nCountry : ${user.country}' : ''} \\nApplication Entitlement : ${allEntitlementsValues}${(task.endpoint.endpointname.equals('CYT-Bank-Portals')) ? ' \\nBank Account\/TCODE : ${requestAccessAttributes?.get('bankaccount')}' : ''}${(task.endpoint.endpointname.equals('CYT-China-wechat-based-SCRM-system')) ? ' \\nBusiness Justification : ${requestAccessAttributes?.get('Justification')}' : ''} \\nApproved by : ${userManager.email} ${usermanager} \\ncomments: ${task.requestKey.comments.replace('<span class=\"busjustformat\">','').replace('</span>','').replace('<br/>','').replace('\"','').replace('\\r\\n',' ').replace('\\n',' ').decodeHTML()} \\nSaviynt Task # ${task.id}\"}}'}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"ticketidPath": "result.number",
"ticketStatusPath": "result.state",
"ticketStatusValue": ["Open", "OPEN", "open"],
"httpContentType": "application/json",
"successResponses": {"statusCode": [200, 201]}
}
]
}


Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.

shivmano
Regular Contributor III
Regular Contributor III

Looks like the issue was with storing the DAs in accounts column. when that was changed it worked 

👍Please click the 'Accept As Solution' button on the reply (or replies) that best answered your original question.


Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.