- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2023 01:11 AM
Hi,
I have the fields Category and Sub Category on the incident table. Sub Category values are dependent on Category. For some values on category there are sub categories and some of the values of categories don't have values in sub category. How can I make Sub Category field mandatory only if he has values according to the Category that was chosen ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2023 09:18 AM
This solution is tried and tested in the PDI and it is giving correct response.
Please check my attached screenshot from my PDI
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2023 03:38 AM
Hi @Alon Grod,
you can make a Ui policy using condition builder to state, that if some specific is chosen in the category, then subcategory should be mandatory.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2023 04:09 AM
@AndersBGS is there any way to make it work in general without mention specific categories?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2023 05:16 AM
If you want to make it mandatory everytime, please follow the below mentioned step:
2) OR you can try making it mandatory from UI policy or client script, please let me know if you need more info on it.
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2023 05:28 AM
Hi @Alon Grod ,
Here the script you can give a try with onchange client script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if ((isLoading && newValue === '') || newValue === '') {
g_form.setMandatory('subcategory', false);
return;
} else {
var subcat = g_form.getControl('subcategory');
var options = subcat.options.length;
alert(options);
if (options > 0) {
g_form.setMandatory('subcategory', true);
} else {
g_form.setMandatory('subcategory', false);
}
}
}
Regards,
Shravan.
Please mark as help and correct answer if this helps you.
Shravan
Please mark this as helpful and correct answer, if this helps you