Variable set: reuse MRV with slightly differrent fields configuration

DuangrutA
Tera Contributor

Hi ServiceNow Community,

 

I find complication in current project.

Is it possible to use same MRV in 2 Catalog Items with different MRV fields configuration?

eg. Catalog 1

MRV

-Storage (New)

-Quantity

eg. Catalog 2

-Storage (New) < Hide this field

-Quantity < Make mandatory

 

As far as I know the Variable selector for UI policy come in the whole MRV.
If I add the UI Policy in MRV then it'll effect on both Catalog items.

 

Any suggestion method to change MRV fields through the script?

 

MRV.pngCatalog UI_MRV.png

1 ACCEPTED SOLUTION

Zach Koch
Giga Sage
Giga Sage

Unfortunately with Variable sets, any changes you make will affect every item they are attached to. The only way you could do what you are suggesting is either

1. Make two separate variable sets.

2. Make whatever UI policy functionality you are trying to do a client script on the variable set instead where in that client script, you check the URL for the sys_id of which catalog item is currently being filled out and build logic into your script that runs different things based on the catalog item. Also could add a hidden variable that fills in onLoad that has the current catalog item being filled out and use that for your client script.

Here is a link to how to get a sys_id out of the URL. This article is in reference to an order guide sys id but the same logic applies for a catalog item.

How to get order guid sysid using client catalog script in service portal? 

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

View solution in original post

3 REPLIES 3

Zach Koch
Giga Sage
Giga Sage

Unfortunately with Variable sets, any changes you make will affect every item they are attached to. The only way you could do what you are suggesting is either

1. Make two separate variable sets.

2. Make whatever UI policy functionality you are trying to do a client script on the variable set instead where in that client script, you check the URL for the sys_id of which catalog item is currently being filled out and build logic into your script that runs different things based on the catalog item. Also could add a hidden variable that fills in onLoad that has the current catalog item being filled out and use that for your client script.

Here is a link to how to get a sys_id out of the URL. This article is in reference to an order guide sys id but the same logic applies for a catalog item.

How to get order guid sysid using client catalog script in service portal? 

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

Ankur Bawiskar
Tera Patron
Tera Patron

@DuangrutA 

this is possible.

1) create onLoad catalog client script and set Applies to MRVS

2) On 2nd catalog item set a string variable with hidden variable with some value which can be used to compare the value

3) then within the onLoad script created in Step 1 access the outside hidden variable and show/hide, make mandatory

I created a blog recently for the same

Access value of catalog item variable within MRVS client script 

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

DuangrutA
Tera Contributor

Thanks for @Ankur Bawiskar  and @Zach Koch answer.

Our team have decided to create seperate MRV instead for easier management.