Testing the visibility of a Record Producer Variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2012 06:39 AM
I have a Record Producer with several Variables. When the RP is submitted I'm dynamically creating content based on the values of these Variables. Some of these Variables may have their visibility hidden based on the selection of other variables. If a Variable is not visible I'd like to exclude the Variable from my dynamic content but I'm having trouble figuring out how to test if it's visible on the form or not.
What can be used to test the visibility of a Variable on a Record producer?
Thanks,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2012 07:32 AM
Do you mean you want to test the visibility of these variables once the actual record is produced, like on the incident form for example? If so, there is an Incident Variable Editor field that will show all the variables once the record producer has been submitted. Just go to Personalize>Form Layout and add it there. I assume that other forms have a similar field such as Change Variable Editor, etc..
If you are talking about testing the visibility on the actual service catalog form when filling out the variables, the only way I know to test there is to try all different options and see which ones are visible and when.
Paul Jordan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2012 08:19 AM
Yes, testing the visibility on the actual service catalog form when filling out the variables. Specifically, when the form is submitted.
In the interest of time, what I ended up doing was to test the value of another variable (the same variable that is used in a Catalog UI Policy to determine the visibility of the other variables).
I tried various techniques including gel() and g_form.getControl(), etc... but couldn't reliably get anything to return if a certain variable was visible on the form.
Anyway, it works but I'll probably return back to this at some point as I don't like hard-coding values and such in script.
Thanks for your reply,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2014 09:53 AM
Once I had to figure out whether the Additional Comments field was hidden or not, then proceed with a client script if it was visible. I used Firebug to get the id of the Comments field. It turned out to be a nice straightforward label.incident.comments
Then at the start of my client script, I attempted to grab the field element like so
var comments_on_form = document.getElementById('label.incident.comments');
If the field was in view, comments_on_form was not null, and if it was not on the form, then a test for null returned true.