- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 03-19-2023 01:00 AM
Hi there,
Hope you are doing well..!
The following article is intended to help people to set values within a Multi Row Variable Set (MRVS) based on value(s) set on a variable on the catalog item.
Let's get started, here we will be using g_service_catalog API.
g_service_catalog is a client-side API that enables accessing data of variables in catalog items to a multi-row variable set (MRVS) when a model is open. This API is available in all environments, such as Service Portal, Now Platform, Workspace, and Now® Mobile.
Result:
Let's just start with the end result that we are trying to achieve. When a user input some value on the catalog item variable same should be set/copied to the MRVS variable.
Here we have to use the OnLoad Catalog client script in MRVS as below.
question1 is a variable of the Catalog item.
multiquestion1 is a variable of MRVS.
function onLoad() {
//Type appropriate comment here, and begin script below multiquestion1
//get field value of the variable in catalog item
var getValueQue1 = g_service_catalog.parent.getValue('question1');
if(getValueQue1){
//set field value to MRVS variable
g_form.setValue('multiquestion1',getValueQue1);}
}
If this post helped you in any way, I would appreciate it if you hit bookmark or mark it as helpful.
Regards,
Hemant Goldar
- 8,177 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Hemant,
I have created username(reference field) in MRVS .when I tried to map this field to description of req_item and task using flow designer .but it showing sys id instead of username .
please let me know how to set value using client script
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Please let me know how to get username from MRVS variable .
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Great, that was exactly what I needed to make some variables inside a Variable Set mandatory based on values from the Catalog Item, my IF statement was exactly like in your screenshot, just instead of setValue I used setMandatory
Thank you 🙂
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
hi @Hemant Goldar ,
i have the similer kind of requriment where
I want to hide the variable inside the variable set depending on the variable outside of the variable set.
have tried with same script but still same issue its showing for every choice field.
below is the script written inside of the MRVS :
this_is_regarding is the choice field (outside of MRVS) on change of if when someone select type_b
then only select_choice field inside of the MRVS should be visible and for other choice it should not be visible ;
but its not working
function onLoad() {
//Type appropriate comment here, and begin script below
var applicationType = g_service_catalog.parent.getValue("this_is_regarding");
if (applicationType == 'type_b') // give the choice value to compare
g_form.setDisplay('select_choice', false);
}
ss is attached for your reference :
can you please help!!
thanks!!