Use of Client script on MRVS

khareakshay
Tera Expert

I have a requirement where a variable named country is present in MRVS and if the value of this variable changes to germany then few set of questions should populate on record producer. Additionally removing the row containing the country as germany should hide that extra questions. This MRVS is used across different record producers where this functionality is not required. Please suggest the a way to achieve this functionality

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@khareakshay 

so basically outside variables should be shown/hidden based on change of inside variable?

if yes then check below links, you will have to detect the add/remove and then handle the logic

Solved: MRVS detect when a row is removed or deleted - ServiceNow Community

Widget that reacts to onChange event of Variable - ServiceNow Community

Solved: Make a Catalog Item Variable Dependent on a MRVS S... - ServiceNow Community

💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron

@khareakshay 

so basically outside variables should be shown/hidden based on change of inside variable?

if yes then check below links, you will have to detect the add/remove and then handle the logic

Solved: MRVS detect when a row is removed or deleted - ServiceNow Community

Widget that reacts to onChange event of Variable - ServiceNow Community

Solved: Make a Catalog Item Variable Dependent on a MRVS S... - ServiceNow Community

💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

@Ankur Bawiskar : The solution given in Solved: MRVS detect when a row is removed or deleted - ServiceNow Community works for me on portal view that is before submitting the record. However I have to implement the same once the record is created. We have the submitted form available on record which can be modified and hence require the same functionality over there as well.

The approach which I followed in service portal is 
1. Detect change in MRVS through widget and update a boolean variable

2. On change client script on that boolean variable will do the further action.

Any recommandations to implement the same in UI 16?

@khareakshay 

detecting change i.e. add/remove on backend i.e. once form is submitted might require DOM manipulation and UI macro as widgets don't work in native

💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏

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