GlideModalForm: has anyone used addParm or setPreference?

tahnalos
Kilo Sage

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

1 ACCEPTED SOLUTION

adam_faulkinber
Kilo Expert


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"].


View solution in original post

13 REPLIES 13

They aren't on the record.   That's the challenge. They are held on a separate form.   This is why I'm trying to pass the parent sys_id so that it would be saved on the dialog when the new info is recorded.



There is a reason for this: the original proposal as brought forward by the project manager (adding said info fields to the form itself) would have necessitated a complete rework of the form's workflow, as the users who have access would require a separate approval chain on top of the existing workflow with regards to the attached info.   Other parts of the workflow would also need to be excluded from the flow under certain circumstances.   Based on their requirements, I felt it was easier to work off another form instead of butchering the existing one and potentially breaking it.



Is there any way to pass info from parent through child via the GlideModalForm object?



Thanks


bump


bump


bump


bump