How can we automatically populate the Site field value based on the Caller field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2025 12:29 AM
How can we automatically populate the Site field value based on the Caller field for a specific catalog item?
Currently, both the Caller and Site fields are populated automatically. However, if the caller's name is changed, the site value does not update accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2025 12:34 AM - edited ‎04-09-2025 12:40 AM
Hello @Ria
To automatically update the Site field based on the Caller field in a catalog item, you can create a catalog client script of type onChange on the Caller variable. This script will run every time the Caller value is changed by the user.
Inside the script, you use a GlideAjax call to send the selected caller's user ID to a Script Include that looks up the user's location field (which typically represents the Site). The Script Include returns the corresponding Site value, and then the client script sets that value into the Site field.
This ensures that whenever the Caller changes, the Site field is automatically refreshed with the correct location tied to the new Caller.
Kindly mark my answer as helpful and accept solution if it helped you.
Regards,
Shubhra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2025 12:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2025 12:34 AM
You can do it multiple ways. Mostly people choose Onchange Client Script to do this. Another option will be SetValue under UI policy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2025 12:45 AM
Is caller a reference variable & is site a string variable?
if yes then you can use auto populate feature and no scripting required
Auto-populate a variable based on a reference type variable (Utah)
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader