- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2021 11:43 PM
Hello, experts!
I'm trying my first attempt at UI action.
It's to pop up a modal after pressing the UI action button to show a specific form view.
The goal is that when the user presses the UI action to transition the status, only the required fields will be shown and after letting the user fill them in, the status will transition.
I have found that the GlideModal/GlideModalForm APIs are effective in achieving the above goal, but the basic part is not working for me.
The following script is what I wrote on my UI action. First, I wrote a minimal script to show the modal.
resolveModalView=This is the view that will show the fields that need to be filled in when setting the status to "resolved".
var d = new GlideModalForm('resolveModalView','table_name');
d.render();
How can I achieve my goal?
I'm looking at the following API description, but I'm not quite understanding it.
I would like to be able to show a modal like the "Start Fix" UI action in issue management.
Best regard.
senon
Solved! Go to Solution.
- Labels:
-
Script Debugger
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2021 10:05 PM
so you want to show record in the modal window?
Do this
var tableName = 'your table name here';
var sysID = ''; // sys_id of the record you want to show
//Create and open the dialog form
var dialog = new GlideDialogForm('My Table Record', tableName);
dialog.setSysID(sysID); //Pass in sys_id to edit existing record,
dialog.addParm('sysparm_view', 'resolveModalView'); //Specify a form view
dialog.render();
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
‎09-22-2021 01:51 AM
Glad to know that my script worked.
Please mark my response as correct and close the thread so that it helps future members.
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
‎09-22-2021 01:52 AM
good article here
Difference between GlideDialogForm, GlideDialogWindow, and GlideModalForm
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
‎09-20-2021 11:59 PM
Hi Senon,
Could you please try by passing your call back function as well and try once. As shown below:
var d = new GlideModalForm('resolveModalView','table_name',callbackFunction(sysverb_save,current.sys_id, table_name, displayValue));
d.render();
If this helps you then please mark it helpful and correct.
Thanks,
Mohit Kaushik
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2021 07:53 PM
Hello, Mohit Kaushik.
I added the call back function and now the modal pops up. Thanks!
var modal = new GlideModalForm('TEST','x_512551_ncm_ticket',abc);
modal.render();
function abc(action, sys_id, table, displayValue) {
//set value on form to new sysid of update set
g_form.setValue('u_solution_description', "test");
}
However, the new create form for the specified table is displayed.
This is not the process I had in mind.
I want the modal to show my specified View with the current record.
What ideas do you have?
Best regard.
senon.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2022 01:37 PM
Hi Mohit,
Can you give me an example on how can I use the call back function?
I am trying to do a multiple update by adding a UI action as a list choice in Incident table.
Basically like the OOB Context Menu 'Update Selected' but instead of Context menu, it will be a pop up window when a UI action is clicked.
Thanks!
Jamie