- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2015 09:14 AM
I'm trying to disable choices on a choice drop-down (via UI Policy) if there is more than one Active Child record linked to the Parent. It's not working and throwing unexpected results. My guess is I'm not using the aggregate function correctly to identify the Parent-Child Relationship. Both these tables - Case (parent) and Case Task(child) are tables that extend from the Primary Task table.
Here's the first code I used (UI Policy):
Unexpected Results:
It cannot be the 'disableOption' calls because I can get those to work on a simple UI Policy when I use a Condition on the 'When to Apply'.
Any help would be appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2015 09:49 AM
Angela,
I doubt if you can use GlideAggregate in Client side thing like UI policy and you can't use 'current' in UI policy
Try something like this:
var count = new GlideRecord('u_ap_case_task');
count.addQuery('active', true);
count.addQuery('parent', g_form.getUniqueValue());
count.query();
var total = 0;
while(count.next())
{
total++;
}
if(total > 1)
{
//do your code here
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2015 09:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2015 10:21 AM
This didn't work either - on a good note, it's not throwing the unexpected results. It's just not disabling the choices.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2015 10:24 AM
Angela,
Thats beause you are using wrong script to disable choice it should be :
g_form.removeOption('u_resolution_action', '1');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2015 10:28 AM
It's this line that isn't work. When I comment it out, then it disables my choice. I've tried both "parent" and "parent.number" and it's just not finding more than one. I don't think it's actually adding up all the records that have this value. It's only finding the one Case Task record that the form is currently on.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2015 10:35 AM
Angela,
If you check my above code, the line should be :
count.addQuery('parent', g_form.getUniqueValue());