Form - New Context Menu section with UI Actions items inside

epinetti
Tera Guru

 

Hello,

I am working on modifying the form Context menu to include three UI actions inside a new Section. The goal is to develop a feature akin to the "Configure" section within the Context Form menu.


New Section Menu -> UI Action 1, UI Action 2, etc

I have been struggling to find information and make progress on this project.

Has anyone implemented this before? Any insights on how to make it work?


Thanks

7 REPLIES 7

Chaitanya ILCR
Kilo Patron

Hi @epinetti ,

if you are trying to add a ui action

that would be showing up above the configure section

 

ChaitanyaILCR_1-1751037487829.png

to add to form context menu check the form context menu checkbox in the ui action record

ChaitanyaILCR_2-1751037599642.png

 

 

if you are trying to add something in the configure section

that's not possible with out Dom manipulation

create a on load client script and use the dom manupulation 

those not UI actions 

 

ChaitanyaILCR_0-1751037357831.png

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

pavani_paluri
Giga Guru

Hi @epinetti,

Create 3 actions:
Example: “UI Action 1”, “UI Action 2”, “UI Action 3”
Check Form context menu as true
Group them under a custom section (like “My Tools”)
ServiceNow doesn’t directly support custom menu sections, but here’s a trick:

You can use an on load client script on the same table to add a fake section header and place your UI Actions below it.
addLoadEvent(function() {
if (typeof gForm != 'undefined') {
// Add a visual section label (non-clickable)
gForm.addContextMenuOption('', '-- 🔧 My Custom Tools --', '', '', '', true);

// Add your UI actions under it
gForm.addContextMenuOption('', 'UI Action 1', 'my_ui_action_1');
gForm.addContextMenuOption('', 'UI Action 2', 'my_ui_action_2');
gForm.addContextMenuOption('', 'UI Action 3', 'my_ui_action_3');
}
});

 

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Pavani P

hi @pavani_paluri 
thanks for this trick.. could you please elaborate a lil bit more how I should process with the step

"Group them under a custom section (like “My Tools”)" ??
Not sure from where I could do that... from the UI Action form definition is not possible to do it

Thanks 

Hi @epinetti,

 

You can group them by creating a fake section using on load client script:

You can use an on load client script on the same table to add a fake section header and place your UI Actions below it.
addLoadEvent(function() {
if (typeof gForm != 'undefined') {
// Add a visual section label (non-clickable)
gForm.addContextMenuOption('', '-- 

pavani_paluri_1-1751046925336.png

 

 My Custom Tools --', '', '', '', true);

// Add your UI actions under it
gForm.addContextMenuOption('', 'UI Action 1', 'my_ui_action_1');
gForm.addContextMenuOption('', 'UI Action 2', 'my_ui_action_2');
gForm.addContextMenuOption('', 'UI Action 3', 'my_ui_action_3');
}
})

 

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Pavani P