- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2022 05:02 AM
Hi,
We have this UI Action for when an Incident is put on hold where a new window pops up for the user to fill in some mandatory fields. I have also created a UI Action button which is appearing in this pop up window but I don't want it to display in there;
I'm not sure where to approach this - should I exclude it from the GlideModalForm UI Action or the button UI Action?
Here's the script that pops the window up when the button is clicked;
function showMyForm(){
//Get the table name and sys_id of the record
var tableName = g_form.getTableName();
var sysID = g_form.getUniqueValue();
//Create and open the dialog form
var dialog = new GlideModalForm('Place '+g_form.getValue('number')+' On Hold', tableName); //Provide title and table name
dialog.setSysID(sysID); //Pass in sys_id to edit existing record, -1 to create new record
dialog.addParm('sysparm_view', 'on_hold_details'); //Specify a form view
dialog.addParm('sysparm_form_only', 'true'); //Add or remove related lists
//setOnloadCallback will set the function to be carried out as the form loads
dialog.setOnloadCallback(function() {
// The below identifies the modal version of the form that is loaded in the frame
var dialogFrame = window.frames["dialog_frame"];
// This applies the On Hold state to the modal version of the form when it is loaded
dialogFrame.g_form.setValue('state', 3);
dialogFrame = null;
});
//setCompletionCallback will set the function to be carried out when the form is successfully submittied
dialog.setCompletionCallback(function() {
// Reloads the parent form once the modal form has been submitted and saves any changes that were made prior to clicking On Hold
g_form.submit();
});
dialog.render(); //Open the dialog
}
The script for the button is nothing fancy but here that is too;
current.work_notes = "A request has been made for an update on this ticket.";
current.u_chase_count += 1;
current.update();
action.setRedirectURL(current);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2022 05:16 AM
Hi,
you can hide that UI action for this view "on_hold_details" using UI action visibility
Also ensure in UI action condition you check whether it's form view or not
Add this as condition in UI action
gs.action.getGlideURI().toString().indexOf('incident.do?sys_id')
Note: I have not tested this part
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2022 05:16 AM
Hi,
you can hide that UI action for this view "on_hold_details" using UI action visibility
Also ensure in UI action condition you check whether it's form view or not
Add this as condition in UI action
gs.action.getGlideURI().toString().indexOf('incident.do?sys_id')
Note: I have not tested this part
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2022 06:36 AM
Thank you Ankur, adjusting the UI action visibility has done the trick.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2023 11:45 PM
Hi Ankur Bawiskar,
Can you please help on this,
2. Create Standard Change
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2023 07:33 PM
Can you post a new question and tag me there as this is older thread?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader