- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2018 08:23 AM
HI
I need to get the sysid of the parent record on UI Action button click. UI action button is placed in one of the related list in the form.
In other words,
Record from table x is displayed on the form.
there are four other tables, A,B,C,D which has a field called Parent which refers to the sys id of the record in the table X. Now I need to get the sysid of the record in the table X on UI Action button placed in one the related list D.
Kindly tell me how to implement this?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2018 01:46 AM
Hi,
Find the UI Actions "New" on the table "Global". These actions work on related lists and support setting the parent on the new record.
If you're creating a client side UI Action for related lists you can get the sys_id of the current record by either:
g_form.getUniqueValue();
Or via g_list:
g_list.getSubmitValue('sysparm_collection_key'); // Field name of relation
g_list.getSubmitValue('sysparm_collectionID'); // sys_id of parent
If you're creating a server side UI Action you need to parse the URL:
var uri = action.getGlideURI();
uri.get('sysparm_collection_key'); // Field name of relation
uri.get('sysparm_collectionID'); // sys_id of parent record
Tim.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2018 09:12 AM
Are the parent record presented in a Reference filed ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2018 01:46 AM
Hi,
Find the UI Actions "New" on the table "Global". These actions work on related lists and support setting the parent on the new record.
If you're creating a client side UI Action for related lists you can get the sys_id of the current record by either:
g_form.getUniqueValue();
Or via g_list:
g_list.getSubmitValue('sysparm_collection_key'); // Field name of relation
g_list.getSubmitValue('sysparm_collectionID'); // sys_id of parent
If you're creating a server side UI Action you need to parse the URL:
var uri = action.getGlideURI();
uri.get('sysparm_collection_key'); // Field name of relation
uri.get('sysparm_collectionID'); // sys_id of parent record
Tim.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2019 07:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 04:21 PM
Having found that UI actions on lists don't support the same behaviour as those on forms ("onclick","client-side" and "server-side" as per the SNGuru) - I'm really grateful I found this post. Many thanks, Tim.
So I see that within the API documentation, g_form.getUniqueValue() is documented:
https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_GlideFormGetUniqueValue
and/or
https://docs.servicenow.com/bundle/kingston-application-development/page/app-store/dev_portal/API_reference/GlideForm/concept/c_GlideFormAPI.html#r_GlideFormGetUniqueValue
However, and maybe I'm just missing it, but is there any developer documentation anywhere on the action object or its methods as shown in the examples above? ... action.getGlideURI() and uri.get([parameter])...
Thanks.