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

SNOW create ticket json is not working please suggest

Diptansu11
New Contributor III
New Contributor III

ServiceNow create ticket json is not working , it was working before then based on some requirement i have added more attributes like user.employeetype, title, startdate, enddate etc. then its not working.

Please review and help me fixing it.


{
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://XXXX.service-now.com/api/agpl2/create_request",
"httpMethod": "POST",
"httpParams": "{\"opened_by\":\"${requestor}\",\"requested_for\":\"${user.username}\",\"assignment_group\":\"MW Identity & Access Mgmt\",\"short_description\":\"This request has been created from Saviynt Security Manager IAM system\",\"RequestID\":\"${if(task.requestKey!=null){task.requestKey?.processinstanceid?.substring(task.requestKey?.processinstanceid?.indexOf('.') + 1, task.requestKey?.processinstanceid?.length())}else if(task.requestKey==null){task.id}}\",\"description\":\"${if(task.tasktype==1 || task.tasktype==3){'Welcome our new team member ' +user.firstname+' ' +user.lastname +' who is scheduled to begin their journey as a ' +user.title +' with us.To ensure a seamless onboarding process we kindly request to perform if there is any prerequisite for this user.'}else if(task.tasktype==2 && (allEntitlementsValues==null || allEntitlementsValues.isEmpty() || allEntitlementsValues=='')){'Welcome our new team member ' +user.firstname+' ' +user.lastname +' who is scheduled to begin their journey as a ' +user.title +' with us.To ensure a seamless onboarding process we kindly request to perform if there is any prerequisite for this user.'}else if(task.tasktype==2 && task.source=='REQUEST'){'Welcome our new team member ' +user.firstname+' ' +user.lastname +' who is scheduled to begin their journey as a ' +user.title +' with us.To ensure a seamless onboarding process we kindly request to perform if there is any prerequisite for this user.'}else if (task.source=='CERTIFICATION' && task.tasktype==2){'This request is to remove access as part User Manager Certification for ' +user.firstname+' ' +user.lastname +' in ' +task.endpoint?.displayName +' application with access '+allEntitlementsValues}else {'Welcome our new team member ' +user.firstname+' ' +user.lastname +' who is scheduled to begin their journey as a ' +user.title +' with us.To ensure a seamless onboarding process we kindly request to perform if there is any prerequisite for this user.'}}\",\"application\":\"${task.endpoint?.displayName}\",\"RequestType\":\"${if(task.tasktype==1){'Add Access'}else if(task.tasktype==2){'Remove Access'}else if(task.tasktype==3){'Create Account'}else if (task.tasktype==8){'Remove Account'}}\",\"tasks\":\"${if(task.tasktype==1 || task.tasktype==3){'Welcome our new team member ' +user.firstname+' ' +user.lastname +' who is scheduled to begin their journey as a ' +user.title +' with us.To ensure a seamless onboarding process we kindly request to perform if there is any prerequisite for this user.'}else if(task.tasktype==2 && (allEntitlementsValues==null || allEntitlementsValues.isEmpty() || allEntitlementsValues=='')){'Welcome our new team member ' +user.firstname+' ' +user.lastname +' who is scheduled to begin their journey as a ' +user.title +' with us.To ensure a seamless onboarding process we kindly request to perform if there is any prerequisite for this user.'}else if(task.tasktype==2 && task.source=='REQUEST'){'Complete this request to remove access for ' +user.firstname+' ' +user.lastname +' in ' +task.endpoint?.displayName +' application with access '+allEntitlementsValues}else if (task.source=='CERTIFICATION' && task.tasktype==2){'This request is to remove access as part User Manager Certification for ' +user.firstname+' ' +user.lastname +' in ' +task.endpoint?.displayName +' application with access '+allEntitlementsValues}else {'Welcome our new team member ' +user.firstname+' ' +user.lastname +' who is scheduled to begin their journey as a ' +user.title +' with us.To ensure a seamless onboarding process we kindly request to perform if there is any prerequisite for this user.'}}\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketidPath": "result.RequestID",
"successResponses": {
"statusCode": [
200,
201
]
}
}
]
}

3 REPLIES 3

SumathiSomala
All-Star
All-Star

@Diptansu11  did you use below variables?

user.employeeType
user.title
user.startdate
user.enddate

Share the error logs

 

Regards,
Sumathi Somala
If this reply answered your question, please Accept As Solution and give Kudos.

I have included below variables:

user.departmentName
user.title
user.startdate
user.employeeid
user.enddate
user.employeeType
user.location
user.email
user.customproperty4

 

kindly let me know if these are fine or not. As i am still facing the same error.

rushikeshvartak
All-Star
All-Star

@Diptansu11  Is it resolved with suggested changes ?


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