- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2018 07:51 AM
One of my ongoing tasks is to find a way to create dialogs to pop up to prompt users to enter additional information before they can access a ticket. Someone recently pointed me to GlideModalForm, which has a lot of prebundled options on how you want the dialog to work. Seems to be working fine except I'm missing a critical piece of information:
I need to pass additional information to the dialog itself opened in GlideModalForm, and the documentation suggests to use either addParm and setPreference. The only issue is that the documentation is very vague on how to use this (which is why I loved the wiki so much more), and that examples provided by others seem to suggest that addParm and setPreference only allows for certain arguments on how the window is to look, and not whether to pass information from one form to another (these examples use sysparm_* variables so I don't think that is correct). Can anyone shed some light to me for this?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2018 10:33 AM
var d = new GlideModalForm('Create New incident', 'incident');
d.setOnloadCallback(populateModal);
d.render();
function populateModal(){
//Access GlideModal g_form
var d_form = window.frames["dialog_frame"].g_form;
d_form.setValue('caller_id', g_user.userID);
//Access GlideModal Scratchpad
var d_scratchpad = window.frames["dialog_frame"].g_scratchpad;
d_scratchpad.myVar = 'Scratchpad Value';
}
You have to access the Modal using window.frames["dialog_frame"].
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2018 10:33 AM
var d = new GlideModalForm('Create New incident', 'incident');
d.setOnloadCallback(populateModal);
d.render();
function populateModal(){
//Access GlideModal g_form
var d_form = window.frames["dialog_frame"].g_form;
d_form.setValue('caller_id', g_user.userID);
//Access GlideModal Scratchpad
var d_scratchpad = window.frames["dialog_frame"].g_scratchpad;
d_scratchpad.myVar = 'Scratchpad Value';
}
You have to access the Modal using window.frames["dialog_frame"].
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2018 01:05 PM
So assuming if I use a scratchpad to pass the object to the GlideModalForm, does that mean I need a second client script onLoad to populate that value?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2018 10:31 AM
Sorry, I misread your code. Turns out I only need the Glide Form version.
Thanks, this worked like a charm.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2018 10:16 AM
Sorry for the confusion. I just threw scratchpad in there because I was using it in my script and thought I'd include it in case you needed it. You would need a client script on the target form to use the scratchpad if you didn't already have one.