Catalog Client Script/Applies on Requested Items...

matthew_magee1
Giga Guru

I've got a CCS that works great. It hides and shows fields, makes mandatory/non-mandatory on the catalog item form perfectly. Why am I using CCS? It's a complex form and we couldn't get the results we wanted using catalog ui policies.

 

On my script, I have 'Applies on Requested Items' TRUE

 

On the order form, the variables hide and show as planned. For example, my script hides the monitor selection for a 24" monitor and shows the monitor selection for a 30" monitor (example)

 

However, when I submit the form and look at the sc_req_item details, both 24 and 30" monitor variables appear even though they don't appear when i am populating the order form through the catalog.

 

Has anyone seen this behavior before? And if so, how did you overcome it?

 

TIA

5 REPLIES 5

Subhajit1
Giga Guru

Hi Matthew,


Sometimes it so happens that while designing the UI, a script would run on a variable more than once, hence negating the intended action that has been taken on it. Please check if you have more than 1 conditions specified for these Catalog Variables.



Thanks,


Subhajit


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Matthew,



If you've got the appropriate checkbox checked and it's working correctly on your catalog item, then it shuoldn't take anything extra to get it to work on the requested item.



That being said, there are a few things that could keep the script from working on the requested item. I would first make sure you're showing all of the variable on the requested item. Then make sure you don't have any client scripts on the requested item itself affecting any of your variables. The other thing I would check would be to see if you have any client side javascript errors on the requested item form. Typically if you get an error in one of the client scripts, the rest of them will not run. You can use chrome's Javascript Console to check that.


matthew_magee1
Giga Guru

Hi all,


Turns out I was calling an isLoading function in my script. When isLoading was true, it basically forgot about the rest of the script, hence why the requested item was still showing 'hidden' variables.



I'll post my script tomorrow when I get back in the office.



Thanks for the great feedback!



Matthew