- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2015 07:02 AM
Hi everyone,
I have a fairly complex process for building servers where the engineer actually fills in variables from the RITM level. The requirement is for certain fields that are not visible during the client filling out the form to be mandatory when the IT engineer receives their task. There is an approval that needs to be done prior to the IT Engineer receiving the task to make the changes, so I can't simply use a UI policy from the beginning. Has anyone ever done some form of script that will make variables mandatory on the RITM level *only* when a specific task is created? I'm pretty stuck here right now.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2015 07:09 AM
You should be able to do a catalog client script of a catalog ui policy that does this, you just need to define your trigger. You can make mandatory once the request is approved:
onLoad
var approval = g_form.getReference('request').approval;
if(approval == 'Approved'){
g_form.setMandatory('field', true);
}else{
g_form.setReadOnly('field', true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2015 07:09 AM
You should be able to do a catalog client script of a catalog ui policy that does this, you just need to define your trigger. You can make mandatory once the request is approved:
onLoad
var approval = g_form.getReference('request').approval;
if(approval == 'Approved'){
g_form.setMandatory('field', true);
}else{
g_form.setReadOnly('field', true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2015 07:13 AM
Okay, I'll see what I can do with the script on the RITM level and see what happens.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2015 08:00 AM
Hi Mike,
I tried using your script and it set the variable to read only, even though it should have been mandatory, meaning the query didn't work. I'm looking for it showing as approved on the RITM level, not the REQ level. Is that the getReference you're using? For me, it looks like it might be the REQ level. I tried this and it didn't work either - any thoughts?
function onLoad() {
var ritm = new GlideRecord("sc_req_item");
var approval = ritm.approval;
if(approval == 'Approved'){
g_form.setMandatory('Server_Name', true);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2015 08:06 AM