- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2022 02:46 AM
Hi All,
How can i make a sub-category 2 field mandatory (which is dependent on sub-category 1 field) only when it has dropdown when the case is getting resolved.
I tried with UI policy but the problem is few of the sub-cat2 does not have any dropdown. So while using UI policy it will make sub-cat2 mandatory all the time even though it does not have any dropdown.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 04:50 AM
1) You are using many brackets unnecessarily
2) You should pass sysid for assignment group reference fields
Update your script as below and pass sysids where ever I mentioned in script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if((newValue == '101') && ((g_form.getValue('assignment_group')=="sysid of group1")||(g_form.getValue('assignment_group')=="sysid of group2")||(g_form.getValue('assignment_group')=="sysid of group3")||(g_form.getValue('assignment_group'))=="sysid of group4"))
{
var subcat2 = g_form.getControl('u_sub_category_2');
var options = subcat2.options.length;
if(options > 1)
{
g_form.setMandatory('u_sub_category_2', true);
}
}
}
Mark as correct and helpful if it solved your query.
Regards,
Sumanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 01:41 AM
Feel free to reach out if you have further questions or else you can mark an answer as correct and helpful to close the thread so that it benefits future visitors also.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2022 07:37 AM
Hi Sumanth,
One more query, while resolving the case, i have not filled the sub-cat and sub-cat2. Since subcat2 length>1 or not will be identified only when sub-cat is filled. At that time it is not making it as mandatory.
1. While resolving the case with no sub-cat and sub2 selected.
2. After selecting the sub-cat, it is still not making the sub-cat2 as mandatory. and the case is getting saved with sub-cat2 filled
can you please help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2022 03:11 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2022 05:22 AM
Hi,
Please mark an answer as correct for this question and create a new question for your new requirement so that it will not confuse others.
You can tag me in that new question so that I can help quick.
Regards,
Sumanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2022 07:49 AM
Mark as correct if the answer solved your query.
You can create new question for new queries.
Regards,
Sumanth