Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

setting variables in client script to readonly/hidden after record is created

sammarcow
Mega Expert

I have a records created through a catalog item, and want the variables following record creation to be readonly.       I created a client script on table sc_req_item with simply alert('click') with no conditions.     The client script only produces the alert when I click "New" for table sc_req_item, not when I load an existing sc_req_item with a variables pool populated.       How do I get these to execute on existing records?

Onload client scripts against table sc_req_item:

function onLoad() {

  alert('click'); //runs only on new item.    

}

1 ACCEPTED SOLUTION

Not applicable

William,



Look at your client script; you should see some checkboxes toward the top. Ensure that "Applies on Requested Items" is checked. This should solve your problem.



However,



I would use UI policies to do what you're attempting. Just create a UI policy with "Applies on Catalog Items" unchecked, and "Applies on Requested items" checked, and then create a UI Policy Action for each variable.


View solution in original post

14 REPLIES 14

Abhinay Erra
Giga Sage

Try clearing cache and load the request item form


I tried this but unfortunately it did not work.   I am able to access the parent object from within a catalog client script now through.     thank you.


Not applicable

William,



Look at your client script; you should see some checkboxes toward the top. Ensure that "Applies on Requested Items" is checked. This should solve your problem.



However,



I would use UI policies to do what you're attempting. Just create a UI policy with "Applies on Catalog Items" unchecked, and "Applies on Requested items" checked, and then create a UI Policy Action for each variable.


Thanks, I was able to get what I need done in a Catalog Client Script which had the checkmark you referred to.     The original post however did mention to the sc_req_item table and the problem persists there so wondering if you have a solution for that as well.   There is a no checkbox for standard client scripts.    



Also, Applying a UI Policy action on each variable won't work because someone down the line will add a variable to the form and not know to set it visibility in a UI Policy. Makes app management a nightmare.