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

CreateAccountJson - get manager username

sushmita
Regular Contributor
Regular Contributor

Hi All,

I am using multiple calls in CreateAccountJson and one of the calls is to get the user's manager & populate it in the target applications' manager field. I am trying to reference the manager's username to achieve this. I am trying the below call for this, but it returns null. Is there anything else I can use apart from ${managerAccount.accountID}   

{
"name": "call3",
"connection": "acctAuth",
"url": "https://xyz/api/now/table/sys_user?sysparm_query=employee_number=${managerAccount.accountID}&sysparm...",
"httpMethod": "GET",
"httpParams": "",
"httpHeaders": { 
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
},

 

 

sushmita_0-1677716873903.png

 

11 REPLIES 11

saikanumuri
Saviynt Employee
Saviynt Employee

please try using ${usermanager.username}

sushmita
Regular Contributor
Regular Contributor

I'm sorry but this did not work for me either.

call2.response.accountID


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

amit_krishnajit
Saviynt Employee
Saviynt Employee

Could you please try the following to fetch the manager's username?

${com.saviynt.ecm.identitywarehouse.domain.Users.findById(user?.manager)?.username}

 

Thanks,
Amit

@amit_krishnajit  - this did not work either

"name": "call3",
"connection": "acctAuth",
"url": "https://xyz.service-now.com/api/now/table/sys_user?sysparm_query=employee_number=${com.saviynt.ecm.i...",
"httpMethod": "GET",
"httpParams": "",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
},

 

Could you please try the following expression? 

${com.saviynt.ecm.identitywarehouse.domain.Users.get(user?.manager)?.username}

 

Thanks,
Amit

sushmita
Regular Contributor
Regular Contributor

If anyone can help with a working copy of createAccountJson where a manager's ID is passed, please provide it to me. I wasn't able to find anything in the integration guide either. 

adriencosson
Valued Contributor
Valued Contributor

Hi @sushmita,

By looking at below documentation, the manager's binding variable is case sensitive and is called userManager.

https://saviynt.freshdesk.com/support/solutions/articles/43000521736-rest-connector-guide 

Therefore, could you try using ${userManager.username} and let us know if that works ?

Hope this helps !

Regards,
Adrien COSSON

Hi @adriencosson , I tried this initially when I went through the guide, but it did not work.

 

 "name": "call3",
"connection": "acctAuth",
"url": "https://xyz.service-now.com/api/now/table/sys_user?sysparm_query=employee_number=${userManager.usern...",
"httpMethod": "GET",
"httpParams": "",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
},
{
"name": "call4",
"connection": "acctAuth",
"url": "https://xyz.service-now.com/api/now/table/sys_user",
"httpMethod": "POST",
"httpParams": "{\"email\":\"${user.email}\",\"first_name\":\"${user.firstname}\",\"last_name\":\"${user.lastname}\",\"employee_number\":\"${user.username}\",\"title\":\"${user.title}\",\"u_llb_wrk_ext\":\"${user.phonenumber}\",\"active\":\"false\",\"u_user_principal_name\":\"${user.email}\",\"u_llb_mail_drop\":\"${user.locationnumber}\",\"u_start_date\":\"${user.startdate}\",\"department\":\"${response.call1.message.result[0].sys_id}\",\"building\":\"${response.call2.message.result[0].sys_id}\",\"manager\":\"${response.call3.message.result[0].sys_id}\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"unsuccessResponses": {
"error.message": "Operation Failed"
}
}
]

Please share full json


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

{
"accountIdPath": "call4.message.result.sys_id",
"responseColsToPropsMap": {},
"call": [{
"name": "call1",
"connection": "acctAuth",
"url": "https://xyx.service-now.com/api/now/table/cmn_department?sysparm_query=name=${user.costcenter}&syspa...",
"httpMethod": "GET",
"httpParams": "",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
},

{
"name": "call2",
"connection": "acctAuth",
"url": "https://xyx.service-now.com/api/now/table/cmn_building?sysparm_query=name=${user.locationnumber}&sys...",
"httpMethod": "GET",
"httpParams": "",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
},
{
"name": "call3",
"connection": "acctAuth",
"url": "https://xyx.service-now.com/api/now/table/sys_user?sysparm_query=employee_number=${userManager.usern...",
"httpMethod": "GET",
"httpParams": "",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
},
{
"name": "call4",
"connection": "acctAuth",
"url": "https://xyx.service-now.com/api/now/table/sys_user",
"httpMethod": "POST",
"httpParams": "{\"email\":\"${user.email}\",\"first_name\":\"${user.firstname}\",\"last_name\":\"${user.lastname}\",\"employee_number\":\"${user.username}\",\"title\":\"${user.title}\",\"u_llb_wrk_ext\":\"${user.phonenumber}\",\"active\":\"false\",\"u_user_principal_name\":\"${user.email}\",\"u_llb_mail_drop\":\"${user.locationnumber}\",\"u_start_date\":\"${user.startdate}\",\"department\":\"${response.call1.message.result[0].sys_id}\",\"building\":\"${response.call2.message.result[0].sys_id}\",\"manager\":\"${response.call3.message.result[0].sys_id}\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"unsuccessResponses": {
"error.message": "Operation Failed"
}
}
]
}