Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Can we pass display value for reference variable while submitting request via OOB API

Kumar4999
Tera Contributor

Currently while submitting the service catalog request using OOB API, When I am passing the sys_id in Reference type of variable the value is taking in the requst as expected.

But if we pass the display value reference field is taking as empty, is there a way we can use Display value in Reference type of variable while submitting the Service Catalog Request via SR OOb API?

 

API: /api/sn_sc/servicecatalog/items/{sys_id}/order_now

 

Example: If I like to select a user in reference filed which referred to User table. Is there a way I can pass the user id or Display name instead of user sys_id while ordering the catalog item similar to table APIs?

 

{
"sysparm_quantity""1",
"sysparm_requested_for":"userid",
"sysparm_no_validation""true",
"variables":
{
"test_user":"edscksacsaksaijd334b1cvdsavgasi"
}
}
12 REPLIES 12

@Kumar4999 

you should be passing the name and not userid

whatever value is present in the name field on sys_user -> set that in API

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar ,

 

Tried the same but still not working

Name field value

Kumar4999_0-1669703543139.png

POSTMAN call using name value

Kumar4999_1-1669703588540.png

 

Still value not inserting

Kumar4999_2-1669703628281.png

 

Regards,

Kumar

manish62
Tera Contributor

Have you found any solution for this issue passing the display value of an reference variable.