- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2014 01:26 PM
Hi everyone,
I'm having a bit of a hard time trying to sort out how to hide a set of variables within a Change Request and potentially its Tasks as well. I have a Record Producer that's used to Create / Update Application CIs in our CMDB. We recently did an overhaul of the form, and in order to make the form look nice in terms of display, the developer had put in four Single-Line Text variables called "Spaceholder." On the form itself, there is no issue as the Catalog UI Policy hides them, but when the record and variables move into the Change Request, all of those variables are visible.
My first reaction was to put through an onLoad Client Script using g_form.setDisplay('variables.spaceholder',false); etc. on the change_request table but it does not seem to compute. My other thought was potentially running some sort of script within the workflow itself to start at the beginning of the workflow with the same sort of script idea.
Has anyone ever needed to try and do this? I've never had any experience doing this for Record Producers that start from sc_req_item and go to change_request - only regular Catalog Items where the one script seemed to work.
Any help or insight at all on this would be greatly appreciated. These variables will never need to be seen at any point.
Thank you,
Amandah
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2014 08:42 AM
The syntax for the or condition is not correct. Something like the following should work:
function onLoad() {
//Type appropriate comment here, and begin script below
var sdesc = g_form.getValue('short_description');
if(sdesc.indexOf('Request for New CI Creation - ') > -1 || sdesc.indexOf('Request for CI Update - ') > -1){
//alert(index);
g_form.setDisplay('variables.spaceholder',false);
g_form.setDisplay('variables.spaceholder2',false);
g_form.setDisplay('variables.spaceholder3',false);
g_form.setDisplay('variables.spaceholder4',false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2014 03:38 PM
Are you trying to remove all variables on the change or just some? If all you can personalize the form and remove the variable editor. If some, you could create a script and delete the spacer ones associated to the change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2014 07:27 AM
I don't want to delete them but I do want them to be hidden. It is only 4 variables out of 108. How would the script look and where would it go? I'm not having an easy time trying to code it in various areas (Catalog Client Scripts and Client Scripts).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2014 03:14 AM
Hi Amandah,
I achieve it doing the same that you did: g_form.setDisplay('variables.spaceholder',false);
"spaceholder" is the variable name? You have to put the same name that the variable has in the variable's table.
Anyway, if you want to remove all of them, Michael response is the best one to achieve that
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2014 07:25 AM
Hi Javier,
Yes, that is the name of one of the four variables. I do not want to hide all of them, I just need specific variables hidden. Is this something that can be coded on its own or do I need to add functions? Should I do this directly in the workflow or do it as a Client Script? I've tried Client Script and Catalog Script and neither seem to work. Record Producer that starts in sc_req_item then moves to change_request seems to be the issue.