How to pass user name instead of sys_id in REST API Explorer using Service Catalog API.

sri2020
Kilo Contributor

Hi,

 

I am trying to create catalog request using this REST API -/api/sn_sc/servicecatalog/items/{sys_id}/order_now 

i used Buy Item (Post)

Catalog is getting created successfully when I am passing this query parameter   -

{"sysparm_quantity":"1","variables":{"description":"TESTING REST API EXPLORER","requestor_information":"true","requested_for":"f3b4d485db499010bdcfd5ab5e961972"},"sysparm_item_guid":"d9bcc9bc1b4e94108dbf42eddc4bcbd2","get_portal_messages":"true","sysparm_no_validation":"true"}

But instead of sys_id of 'requested_for', I want to pass name of the user. Please help.

 

Regards

Sri 

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Sri - Give it a try

{"sysparm_quantity":"1","variables":{"description":"TESTING REST API EXPLORER","requestor_information":"true","requested_for.user_name":"PASS USER NAME"},"sysparm_item_guid":"d9bcc9bc1b4e94108dbf42eddc4bcbd2","get_portal_messages":"true","sysparm_no_validation":"true"}

View solution in original post

7 REPLIES 7

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Sri - Give it a try

{"sysparm_quantity":"1","variables":{"description":"TESTING REST API EXPLORER","requestor_information":"true","requested_for.user_name":"PASS USER NAME"},"sysparm_item_guid":"d9bcc9bc1b4e94108dbf42eddc4bcbd2","get_portal_messages":"true","sysparm_no_validation":"true"}

Did the solution work.? It is not working for me. I tried the same way, but the variable is empty in the RITM.

 

{"sysparm_quantity": "1","variables": {"u_effective_date": "2020-07-28","action_type": "Add","u_requested_for.user_name":"testitil","u_ad_grps":"2ac9c6c61bf9a010a5ccfd12dd4bcbd3","u_manager_name":"abu123","u_manager_id":"testitil","u_network_id":"ariyazu"},"get_portal_messages":"true","sysparm_no_validation":"true"}

 

@sri2020 

Hi @Pradeep Sharma Kindly help. This solution is not working for me. I used the parameter as u_requested_for.user_name: USER ID. Still the variable is empty in RITM. Reached to SNOW HI team and they are claiming the reference field will accept only sys id and it is not possible to pass user name. HI Ticket CS5253992.

Thank you, It worked