- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2024 03:38 AM - edited ‎10-22-2024 03:39 AM
Hi Team,
I am trying to call a particular view from a ui action.
scenario :-
when I click on "On hold" ui action in incident table, i need a specific view "on_hold_dialog_view" to get displayed as a popup.
Can I know how i can call this view in Ui action
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2024 04:29 AM - edited ‎10-22-2024 04:29 AM
Hi @Roshini
UI Action Client checkbox should be true and onClick use openPopup() method.
I did similar requirement long back, Adding code below. Modify according to your requirement.
function openPopup() {
var tableName = ''; //table name here
var sysid = g_form.getUniqueValue();
//Create and open the dialog form
var dialog = new GlideDialogForm('Title', tableName); //Provide dialog title and table name
dialog.setSysID(sysid); //Pass in sys_id to edit existing record, -1 to create new record
dialog.addParm('sysparm_view', 'Reasons'); //Add view of the form
dialog.setLoadCallback(function(iframeDoc) {
// To get the iframe: document.defaultView in non-IE, document.parentWindow in IE
var dialogFrame = 'defaultView' in iframeDoc ? iframeDoc.defaultView : iframeDoc.parentWindow;
dialogFrame.g_form.setValue('u_number', g_form.getValue('u_number'));
dialogFrame.g_form.setValue('u_state', 'Completed');
dialogFrame.g_form.setMandatory('u_justification', true);
dialogFrame.g_form.setReadOnly('u_select_user', true);
dialogFrame.g_form.setReadOnly('u_hiring_manager', true);
dialogFrame = null;
});
dialog.render(); //Open the dialog
}
Refer Below article
https://servicenowguru.com/system-ui/glidedialogwindow-quickforms/
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2024 04:29 AM - edited ‎10-22-2024 04:29 AM
Hi @Roshini
UI Action Client checkbox should be true and onClick use openPopup() method.
I did similar requirement long back, Adding code below. Modify according to your requirement.
function openPopup() {
var tableName = ''; //table name here
var sysid = g_form.getUniqueValue();
//Create and open the dialog form
var dialog = new GlideDialogForm('Title', tableName); //Provide dialog title and table name
dialog.setSysID(sysid); //Pass in sys_id to edit existing record, -1 to create new record
dialog.addParm('sysparm_view', 'Reasons'); //Add view of the form
dialog.setLoadCallback(function(iframeDoc) {
// To get the iframe: document.defaultView in non-IE, document.parentWindow in IE
var dialogFrame = 'defaultView' in iframeDoc ? iframeDoc.defaultView : iframeDoc.parentWindow;
dialogFrame.g_form.setValue('u_number', g_form.getValue('u_number'));
dialogFrame.g_form.setValue('u_state', 'Completed');
dialogFrame.g_form.setMandatory('u_justification', true);
dialogFrame.g_form.setReadOnly('u_select_user', true);
dialogFrame.g_form.setReadOnly('u_hiring_manager', true);
dialogFrame = null;
});
dialog.render(); //Open the dialog
}
Refer Below article
https://servicenowguru.com/system-ui/glidedialogwindow-quickforms/
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2024 05:02 AM
Am able to open the view as per your code
but it is showing all the ui actions as well, I don't want the ui actions to be visible.
Is there anything that we can do for it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2024 05:54 AM
Hi @Roshini,
You might need to add the below line of code:
dialog.addParm('sysparm_hideButtons', 'true'); // This hides all UI action buttons
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2024 06:15 AM
Tried this.
But still seeing the UI action