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

Lock and Unlock Account in Service Now Rest Connection

Kirti14
New Contributor III
New Contributor III

I tried  working on lock account task but it is no working. Task is created in pending state but ticket is created and closed_completed from service now end but still task is in pending state with closed_completed comment:

Createticketjson:

 

{
"ticketidPath": "call2.message.result.request_number",
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://xxxxxxxxxxxxxxxxxx/api/now/table/sys_user?sysparm_query=email=${user.email}&sysparm_fields=s...",
"httpMethod": "GET",
"httpParams": "{}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
},
{
"name": "call2",
"connection": "acctAuth",
"url": "https://xxxxxxxxxxxxxxxxxxx/api/sn_sc/servicecatalog/items/f2dd6c5e97c2c6507bee9614a253afe7/order_no...",
"httpMethod": "POST",
"httpParams": "{\"sysparm_quantity\":\"1\",\"variables\":{\"requested_for\":\"${response.call1.message.result.sys_id[0]}\",\"app_name\":\"Test Application\",\"access_profile_name\":\"${task.tasktype}\",\"saviynt_reference\":\"001\",\"endpoint_endpointname\":\"${endpoint.endpointname}\",\"endpoint_displayname\":\"${endpoint.displayName}\",\"allentitlementsvalues\":\"${allEntitlementsValues}\",\"account_name\":\"${task.accountName}\",\"accountdetails\":\"${String v = ''; requestAccessAttributes.each{(it.key != 'ACCOUNTKEY' && it.key != 'REQUESTORIGIN' && it.key != 'ACCOUNTNAME' && it.key != 'ENDPOINT') ? v+=it.key + ': ' + it.value + '\\\\n' : ''}; return v;}\"}}",
"httpHeaders": {
"Content-Type": "application/json",
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketStatusPath": "result[0].request_state",
"ticketStatusValue": "closed_complete",
"successResponses": {
"statusCode": [
200,
201
]
}
}
]
}
Statusticketjson:

{
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://xxxxxxxxxxxxxxxxx/api/now/table/sc_request?sysparm_query=number=${ticketID}&sysparm_fields=r...",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketStatusPath": "result[0].request_state",
"ticketStatusValue": [
"CLOSED",
"Closed",
"closed",
"closed_complete"
],
"disContinueStatusValue": [
"closed_incomplete",
"closed_cancelled",
"closed_rejected",
"closed_skipped"
],
"successResponses": {
"statusCode": [
200,
201,
202,
203,
204,
205
]
}
}
]
}

Even runned in postman and it is giving proper response:

Kirti14_0-1719494587208.pngKirti14_1-1719494625103.pngKirti14_2-1719494658396.png

Kirti14_3-1719494793011.png

 

 

@ kindly help me out

11 REPLIES 11

Kirti14
New Contributor III
New Contributor III

It is working for add, remove, enable ,disable account properly but only creating issue for lock and unlock account

If issue with lock and unlock share those json above post mentioned ticket jsons


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

{
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://xxxxxxxxxxxxxxxxx/api/now/table/sc_request?sysparm_query=number=${ticketID}&sysparm_fields=r...",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketStatusPath": "result[0].request_state",
"ticketStatusValue": [
"CLOSED",
"Closed",
"closed",
"closed_complete"
],
"disContinueStatusValue": [
"closed_incomplete",
"closed_cancelled",
"closed_rejected",
"closed_skipped"
],
"successResponses": {
"statusCode": [
200,
201,
202,
203,
204,
205
]
}
}
]
}

Are you doing lock account in ticket status json ?


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

yes. Actually I am not sure where exactly it needs to be done otherwise apart from statusticketjson.

It needs to be added in Enable/Disable Status JSON

rushikeshvartak_0-1719510327289.png

 


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

Kirti14
New Contributor III
New Contributor III

okay

Kirti14
New Contributor III
New Contributor III

It is still no working. Facing same issue
@kindly help

Kirti14
New Contributor III
New Contributor III

Disable account json code:
{ "call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://xxxxxxxxxx/api/now/table/sys_user/${account.accountID}"
,
"httpMethod": "PUT",

"httpParams": "{ \"active\": \"false\", \"locked_out\": \"true\" }",


"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204
]
}
}
]
}

It is a  service desk connection 

@ It is still not working

flegare
Regular Contributor III
Regular Contributor III

Hi @rushikeshvartak ,

Little more information... this is set in a Service Desk connection.

We are issuing a ticket for lock account, task is fulfilled manually on target system and ticket is updated to closed_complete, just like any other provisioning ticket.

However, Saviynt does not complete the task, in the same fashion it completes the task for other task types we experimented with (enable/disable, add/remove access, create account, etc).

We do not enable/disable from this connection itself, the expectation is to reconcile the operation later on through flat-file...

To summarize issue you are creating ticket for lock/unlock and its not getting processed ? Its looks like defect please raise support ticket.

 


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