Skip to content

Mrvs interact with parent form #1083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//Using this Catalog Client Script that Applies to the Catalog Item will enable g_form methods like setValue and clearValue which affect Catalog Item variables from a Catalog Client Script that applies to the multi-row variable set
function onLoad() {
if (this) {//we only need to do this for Service Portal
//We need to make the g_form object for the parent item available from the MRVS window
this.cat_g_form = g_form;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
Use the g_service_catalog.parent object to interact with the parent form from within a MVRS script
//These methods can be used onLoad, onChange, or onSubmit in a script that Applies to the MRVS

//Retrieve a variable value from the parent form
//Retrieve a variable value from the parent form - works in native UI as well as Service Portal, etc.
g_service_catalog.parent.getValue('variable_name');

//Set a variable value on the parent form
g_service_catalog.parent.setValue('variable_name');
//With this approach, you can set a variable value on the parent form - use similar code for other g_form methods like clearValue
//Service Portal method requires an additional Catalog Client Script onLoad that Applies to the Catalog Item
if (this) { //Service Portal method
this.cat_g_form.clearValue('variable_name');
} else { //native UI method
parent.g_form.clearValue('variable_name');
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Use this code snippet to interact with the parent form (i.e the main catalogue item) from within a catalog client script on a Multi-row variable set.
Use this code snippet to interact with the parent form (i.e the main Cataloge Item) from within a Catalog Client Script that applies to a multi-row variable set.

The g_service_catalog object allows for accessing the "parent" GlideForm (g_form) object and its related functions
The g_service_catalog object allows for accessing the "parent" GlideForm (g_form) object for getValue only (for now?)
To affect a variable in the main catalogue item using setValue, clearValue, etc. parent.g_form... is available in the native UI, and this.cat_g_form... can be used for Service Portal, etc if an additional Catalog Client Script is used, this one onLoad that Applies to the Catalog Item (not the MRVS).
Loading