Override Variable Set Default Value in Catalog Item

jmiskey
Kilo Sage

We use the Service Portal quite heavily.  We have a lot of Catalog Items on it.  For efficiency sake, we have a Variable Set that we use in the majority of our Catalog Items that returns a bunch of information about the Requestor and their Manager.  In this variable set, the "requested_for" field has the default value of:

javascript: gs.getUserID();

so it defaults to the person filling out the sheet , and then there are Catalog Client Scripts to populate all the related information about the user and their manager.

We have a "New Hire Onboarding" form that uses this Variable Set, but the issue is that a user would NEVER be filling out their own "New Hire Onboarding" form (as matter as fact, I need to ensure that the requestor CANNOT choose themself, which I can do with some Catalog Client Scripts).

So, what I really want to do is to "override" the default in the Variable Set.  But here is the tricky part -- I need to do this without making any changes to the Variable Set (under strict order from boss not to mess with that).  So, I need to do it using Catalog Client Scripts from the "New Hire Onboarding" Catalog Item.  

I was able to add code to clear the "requested_for" value, but it appears that runs AFTER the default is applied, so it left all the related User and Manager information populated, even though the "requested_for" value was cleared.  I think what I need to figure out is how to override the "default", so it is never applied in the first place, so those other related fields do not get an initial population based on the default value.

Does anyone have any good ideas on how to best accomplish this (without trying to write a whole bunch of code to undo everything)?

Thanks

 

10 REPLIES 10

You can see all my scripts, in the post above.  I tried removing the check marks next to RITMs and Tasks in the last two Catalog Client Scripts (the ones on the Order Guide), but it did not make any difference.