- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 07:45 AM
Hello Developers,
I have a requirement where an RITM is created from an Incident using the 'Relates Search Results' functionality. From there, users can search for a Service Requester and click on ‘Order’, which redirects them to the catalog item using the servicecatalog_cat_item_view form.
In this context, I’d like to auto-populate the field what_is_source_of_exception_requirement on the catalog item with the incident number (i.e., the parent record of the RITM).
Here’s the URL being used:
com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=8ea574d297a62290cbf4b976f053af12&sysparm_view=catalog_default&sysparm_parent_table=incident&sysparm_parent_sys_id=096777069726ee50cbf4b976f053af57
I attempted this via a client script, but it doesn’t seem to work—likely because client scripts can’t access server-side data like the incident number directly using GlideRecord.
Could you please advise if this can be achieved, and if so, what would be the recommended approach?
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2025 12:37 AM
I already informed to use GlideAjax and query INC table and get number
Another way is to use GlideRecord with callback
Something like this
function onLoad() {
var gUrl = new GlideURL();
gUrl.setFromCurrent();
var incSysId = gUrl.getParam("sysparm_parent_sys_id");
var gr = new GlideRecord('incident');
gr.addQuery('sys_id', incSysId);
gr.query(checkRecord);
function checkRecord(gr) {
if (gr.next()) {
g_form.setValue('what_is_source_of_exception_requirement', gr.number);
}
}
}
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2025 12:48 AM
GlideRecord with callback should be fine.
Another way I already told to use GlideAjax
I believe I have answered your question.
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