How to hide some variable set variables from only some catalog items

Khalnayak
Tera Guru

Hello,

I need some advise and help please.

We are using a variable set which sets variables for multiple catalog items / record producers.

This variable set is included in many items, and the variable set calls script includes to check logic and show fields accordingly.

We have a requirement to hide some of the options from a few catalog items, without affecting the others.

What is best way I can hide some fields on certain catalog items please?

have tried using UI policies on the actual catalog items that need hiding but that does not work.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

something like this

onLoad catalog client script which Applies on Variable Set

function onLoad(){
	var itemSysId = g_form.getUniqueValue();
	if(itemSysId == 'your Catalog item SysId'){
		// hide variables with that variable set one by one
	}
}

If you are thinking hard-coding is not best practice then use onLoad client script + GlideAjax and within that ajax function use getProperty() to get catalog item sysId and then compare and return true/false

Regards
Ankur

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

View solution in original post

13 REPLIES 13

Thanks Ankur, you are most likely right, there are quite a few UI policies and client scripts for this variable set.

What would be your suggestion on how to move forward with this?

Hi,

You need to debug which one is responsible and discuss with your customer what's their exact requirement.

I believe I have answered your original question.

Please mark my response as correct and helpful to close the thread.

Regards
Ankur

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

Musab Rasheed
Tera Sage

Hello,

UI policy show work 100%, make sure you create UI policy on Catalog item level and not at variable set level, This is simple

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab

@Khalnayak : Did you get chance to check my comment ?

Please hit like and mark my response as correct if that helps
Regards,
Musab