GlideModalForm: other than current view

MichaelZischeck
Kilo Sage

I'd like to have a dialog with full form functionality (reference fields, dependant fields, everything).

GlideModalForm, I figured, is the only way to go.

but I would like to display the dialog in a different view, a stripped down version, of the actual form.

 

Is this possible? On the dialog I did not find anything.

What I could imagine though: is finding the current form on the list, setting my desired form, do my stuff, set the form on the list back to what it was before

1 ACCEPTED SOLUTION

John Dewhurst
Kilo Guru

You can use the addParm method to set the view using the sysparm_view parameter

var gp = new GlideModalForm("TITLE", "TABLE", callbackFunction);
gp.addParm('sysparm_view', "VIEWNAME");
gp.render();

View solution in original post

9 REPLIES 9

John Dewhurst
Kilo Guru

You can use the addParm method to set the view using the sysparm_view parameter

var gp = new GlideModalForm("TITLE", "TABLE", callbackFunction);
gp.addParm('sysparm_view', "VIEWNAME");
gp.render();

great tip.... trying to get it work.. but somehow it doesn't...  I can use addParm to set the sys_id, such that it loads content from an existing record. If I try to change a field using addParm (eg. short_description) it does not update that field. It neither adds the "parm" to the url to use my required form...

 

but interesting approach anyway, thanks

Seems odd, it is what is done in at least 2 OOTB scripts I can find...
/sys_script_client.do?sysparm_query=`name=Dialog%20functions

/sys_ui_macro.do?sysparm_query=name=kb_my_suggested_edits

your solution and this line do the trick:

   d.addParm("sysparm_view_forced"true); does the trick... so you helped me really getting on the right path!

 

here's my blog about it https://inmood.ch/update-selected-records/