'Requested for' user details not getting auto populated through postman ebonding integration request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
Hi Community,
I have a requirement in a catalog item to Autopopulate 'Requested For' user in a reference variable [EU03] which references to User table. Based on this user I need to autopopulate next two variable fields in the catalog item. i.e Email ID [EU04] and User ID [EU05] of requested for user. And the EU04 and EU05 should change according to the user selected in EU03 field as it user can select any user. For this requirement I'm using 2 catalog client scripts.
This is working as expected in both native UI and portal. But when RITM is raised through postman ebonding request the fields which I want autopopulate are coming empty.
What could be the reason and what is the alternate solution to acheive this requirement? Please provide your valuable inputs.
Onload client script to autopopulate requested for user:
onchange client script to autopopulate email id and user id according to user selection:
#developer #catalogitem #clientscript #requestedfor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
Share ur script include snap please
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago - last edited 11 hours ago
your client script will run only in UI & won't run when the request gets generated using API which is server side
you should handle this using your custom logic, either via after insert on RITM or if you are creating the RITM using Cart API from Scripted rest api then handle it there
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago - last edited 8 hours ago
Hi @SumajRajNk,
The ebonding happens in backend and client script is on UI level, so it understandably wont work.
You can handle this in a before insert BR (you may have to do for other ebonding items so not viable option), or handle the requestor user variable and the requestors details in payload or at fulfillment level by the agent adding requestor in the field and their user details get autopopulated (viable option).
If this response resolved your issue, please consider marking it as Helpful and accepting it as the Solution. Your feedback helps other ServiceNow Community members find reliable answers.
Kind Regards,
Ehab Pilloor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
Hi @Gillerla Rajesh
Client-side validation (client scripts and UI policies on the catalog item) does not run when a RITM is created through an integration, because there is no form or browser involved. To handle this, the validation should be applied at the integration level itself, before the order is placed, or the logic should be applied on the server side after the RITM is generated, for example with a business rule on sc_req_item.
and My suggestion is The payload only needs the requested-for name (first and last), the catalog item, and the requester. Instead of the caller supplying a User ID and email, the script takes the name and passes it to two helper functions: one generates a unique User ID (first initial plus last name, with a number added if it already exists in sys_user), and the other builds a unique email from that User ID plus the company domain, which is kept in a system property. The main function uses the values these helpers return to fill the User ID and email variables on the catalog item, then adds the item to the cart, places the order, and returns the request number, RITM number, User ID and email.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank You