The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Populate Variable of a Multi row variable set Dependent on another variable of Catalog Item

rohanbhatia
Tera Contributor

I have a variable named as Product category in the catalog item which is Reference.
I have a multi row variable set, inside this I have another variable "category" which is also reference. I want to populate category same as product category when user click add button of MRVS and when pop up open up. How can i do this?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@rohanbhatia 

so basically you can use onLoad catalog client script which Applies on Variable Set and select your MRVS

Use this logic to grab outside variable and set in Product Category

Note: I assume both the variables are referring to same table

function onLoad() {
    //Type appropriate comment here, and begin script below

    var val = g_service_catalog.parent.getValue("productCategoryVariableName"); // give the outside variable name here
    g_form.setValue('categoryVariableName', val); // give mrvs variable name here

}

AnkurBawiskar_0-1758711570465.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @rohanbhatia 

You mean you want to bring the Product Category from the backend and display it when a user selects the product?
I don't think it's directly possible on the frontend, but it can be accessed and used from the backend.

 

https://www.servicenow.com/community/workflow-automation-articles/how-to-use-multirow-variable-sets-...

https://www.servicenow.com/community/developer-forum/mrvs-dot-walking-in-flow-designer/m-p/2668991

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron
Tera Patron

@rohanbhatia 

so basically you can use onLoad catalog client script which Applies on Variable Set and select your MRVS

Use this logic to grab outside variable and set in Product Category

Note: I assume both the variables are referring to same table

function onLoad() {
    //Type appropriate comment here, and begin script below

    var val = g_service_catalog.parent.getValue("productCategoryVariableName"); // give the outside variable name here
    g_form.setValue('categoryVariableName', val); // give mrvs variable name here

}

AnkurBawiskar_0-1758711570465.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

It worked, Thanks @Ankur Bawiskar 

 

 

@rohanbhatia 

Glad to help.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader