Read-only Multi-Row Variable Set - ServiceNow Community
Mark Roethof
Tera Patron
Tera Patron

Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

 

Hi there,

 

While working with the Multi-Row Variable Set on Catalog Items, a while ago I stumbled on the Multi-Row Variable Set being editable when working on Requested Items on the Platform UI. Because in our organization we tend to make all variables within the Variables editor Read-only, I did some diggin' on how to make the Multi-Row Variable Set Read-only.

 

I have answered some community questions on this topic recently, so not completely new. Though I'll try to give some additional information in this short article.

Related Community articles

While searching if someone already posted a question or written an article, I did come across some articles. For example, Tips and Tricks : MRVS (Multi Row variable set) : Part 2. Reading this, it does work fine, it does what it describes. Though, adding a UI Script, editing a Service Portal widget, etc.. Can't this been done easier?

Catalog UI Policy

My thought was, could this already be done through Catalog Client Script (with something like g_form.setReadOnly('internal_name_of_mrvs', true); or thru Catalog UI Policy and a Catalog UI Policy Action? Good news:

 

Catalog UI Policy, quick, maintainable, no code!

 

It's just a matter of adding a Catalog UI Policy, having "Applies on a Catalog Item view" unchecked, having "Applies on Requested Items" checked. The Catalog UI Policy then just needs a Catalog UI Policy Action. Within the Catalog UI Policy Action you could just select the Multi-Row Variable Set at the "Variable name" (it will just be listed there), and set "Read-only" to true.

 

find_real_file.png

Result

Before applying the Catalog UI Policy:

 

find_real_file.png

 

After applying the Catalog UI Policy:

 

find_real_file.png

 

Note: Tested on Madrid and New York.

---

And that's it actually. Hope you like it. If any questions or remarks, let me know!

 

C

If this content helped you, I would appreciate it if you hit bookmark or mark it as helpful.

 

Interested in more Articles, Blogs, Videos, Podcasts, Share projects I shared/participated in?
- Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

 

Kind regards,


Mark Roethof

ServiceNow Technical Consultant @ Paphos Group
---

LinkedIn

Comments
Jamie49
Tera Contributor

I am able to get the read only, however on the catalog item you can still 'delete' the items in the variable set or edit them. I want to just display the variable set as read only. No adds, edits or delete (x). 

In the example below I can still hit an X and delete that row. 

 

find_real_file.png

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Can you share steps to reproduce? I did a quick test again, though the MRVS is read-only here, also now edit/delete.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

Naresh291
Tera Contributor

Hey Mark ,

I really found your article quite helpful.

I have a similar kinda requirement.

I have a variable inside the MRVS , which has to be made read only upon certain condition .

Here is the code

 if (answerstr == 1) {
g_form.setReadOnly('u_owner',true); 

Where answerstr is the response from the script include .

I see the line of code right below the    g_form.setReadOnly('u_owner',true);

 works fine , but this readOnly code  doesnt work .

Can you help me with this .

 

Thanks!

Naresh

Shaileema
Giga Contributor

Were you able to resolve this issue? I am facing the same issue.

 

rkreddy
Giga Expert

Hi Jamies,

I am also getting the same issue. Could you please share the solution for this?

itoma
Tera Contributor

Hello!
This solution worked for me only when I applied the Catalog UI Policy at the Catalog Item level, not at the Multi-Row Variable Set level.
Maybe this is the confusion for those who couldn't implement it.

Thanks @Mark Roethof  for your help!

Anil9866
Tera Contributor

Hello All,

I've tried the same solution for the Multi-Row Variable Set, which is implemented in service portal, but unable to make it as read only

Steps to reproduce:
1) Created a catalog UI policy on the catalog item

2) Checked only the Applied on Requested items

3) Created Catalog UI policy Actions on the Multi-Row Variable Set and make the Read only TRUE.

 

Unable to make the Multi-Row Variable Set as read-only. 

 

Could someone please help here, thanks in advance

Version history
Last update:
‎08-13-2024 10:56 AM
Updated by:
Contributors