- 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-20-2021 11:55 PM
Hi,
this should be the complete one; if you wish to show table
var gdw = new GlideModal('show_list');
gdw.setTitle("My Table");
gdw.setSize(750);
gdw.setPreference('table', 'incident_list'); // your table name here with _list
gdw.setPreference('sysparm_view', 'viewName'); // your view name here
gdw.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-21-2021 08:58 PM
Hi Ankur.
Thanks to this code, I was able to display the resolveModalView.
However, the records are shown as newly created.
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
‎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:34 AM
Thank you Ankur.
I was able to view what I was looking for.
Two questions, what is the difference between GlideModalForm and GlideDialogForm?
Is there an article that explains GlideDialogForm?
Best regard.
senon.