How to call UI action on a form section using UI macro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2023 03:19 PM - edited ‎05-25-2023 03:20 PM
Hi,
We have a UI action that is displayed a link under related links on the form. But user wants that link to be displayed on a section with the form. So, want to call this UI action using UI macro and formatter onto the form section. Please assist on how to call UI action through UI macro.
Here's the UI action code (when user clicks on the link, it returns name/value pair type):
This triggers on click of manageLocation()
function manageLocation(){
var label = getMessage("Manage Location");
var sys_id = g_form.getUniqueValue();
var loc = g_form.getValue('u_location');
if(loc) {
loc = JSON.parse(g_form.getValue('u_location'));
}
var arr = [ ];
Objects.keys(loc).forEach(function(key) {
arr.push(key + ': : :' + loc[key]);
});
var dialogClass = GlideModal ? GlideModal : GlideDialogWindow;
var dd = new dialogClass('sn_apm_location');
dd.setPreference('sysparm_sys_id_ba', sys_id + ' ');
dd.setPreference('sysparm_loc', arr.toString());
dd.setTitle(title);
dd.setWidth(500);
dd.render();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2023 05:35 AM
you can directly call the UI page from UI macro
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2023 07:09 AM
Hi @Ankur Bawiskar , I'm trying to call UI action through UI macro onto the form. Can you please help with the process?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2023 08:24 PM
try using this in UI macro <script> tag
g_form.submit(actionName); // give the ui action action name here
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader