- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2015 06:57 AM
Hi all. I've been reading some of the many discussions on Catalog Task variables in order to resolve my issue but haven't found anything definitive. Here's what I'm trying to achieve:
On a Catalog Task I have two variables 'sdr_replace_success' and 'sdr_issues'. sdr_replace_success is a Yes/No field with None. If the selection is 'no' I want to make sdr_issues mandatory. To do this I've been trying to use a UI Policy with Scripts enabled. Here is what I've ended up with with no success:
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2015 07:12 AM
I think you are creating this as a "normal" UI Policy on the Task form, correct? I would create it as a Catalog UI Policy instead and check the "Applies to Catalog Tasks" field:
You may have to switch to the the "Advanced" view to see the field. And then you can use a "Catalog UI Policy Action" to set the variable to mandatory instead of with a script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2015 07:22 AM
Perfect Jim, thank you. I hadn't realised those Advanced options were available!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2015 07:34 AM
Yeah, I wish they had not created all those "Advanced" views and hide some pretty basic options on them where a lot of people never see them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2015 07:24 AM
Agree. If you're just setting it based on variables alone, this is the best solution. If you want to use the catalog task fields, this won't work as far as I know. In my case, I don't want these fields mandatory until the task is being closed but I don't see anything to allow that. I can do it on the sc_task ui policy instead using the scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2015 07:12 AM
This wiki article covers the topic:
actually variables. should be there as explained on the wiki, there may be a field already called that variable name.
- g_form.setMandatory(name, mandatory)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2015 07:21 AM
Maybe because it's considered a related field. I've found in the past that UI policies don't work well with related field values in the conditions. Not sure if this has changed.
I found I had the same problem if I tried to put a variable as a condition. Instead, what worked for me is that I do some condition check within the script itself. For my stuff, I want to set some variables to mandatory if the task is being closed and another variable is set to a certain value.
My condition is:
State is Closed Complete AND
Request Item.Item is <My item containing the variable>
In the script I do a check. If it's being closed and the user selected "direct line", I want the direct line field to be mandatory.
function onCondition() {
if (g_form.getValue('variables.phone_requirements') == 'Direct Line') {
g_form.setMandatory('variables.phone_did',true);
}
}