Make category field mandatory when state changes from review to closed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2023 02:12 PM
Hello all!
I am looking to make the category field mandatory on the change form.
when the state on changes from review to closed
make the category field to mandatory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2023 02:34 PM
Hi @Mitchell_Milo ,
Hope you are doing well.
Are you using change management module out of the box ?
If yes the you can use UI policy as you can only modify the state to closed if state is review
If you are not using OOB change management then please go for client script as "changes to" and "changes from" conditions are not available in the UI policy condition.
Please mark this response as correct or helpful if it assisted you with your question.
Regards,
Harshal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2023 02:50 PM
I did onChange but does not work, what am I doing wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2023 03:00 PM
Hi @Mitchell_Milo ,
Please try below code -
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(oldValue == 0 && newValue ==3){
// 0 is backend value of review and 3 is backend value of closed OOB
g_form.setMandatory("category",true);
}
else{
g_form.setMandatory("category",false);
}
}
Please mark this response as correct or helpful if it assisted you with your question.
Regards,
Harshal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2023 10:25 PM
Hi @Mitchell_Milo ,
Why not just make a UI policy? No script is needed to make a field mandatory based on another field?
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/