Make category field mandatory when state changes from review to closed

Mitchell_Milo
Tera Contributor

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. 

4 REPLIES 4

Harshal Aditya
Mega Sage
Mega Sage

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

I did onChange but does not work, what am I doing wrong?

Mitchell_Milo_0-1692049809674.png

 

Harshal Aditya
Mega Sage
Mega Sage

Hi @Mitchell_Milo ,

 

Please try below code -

 

HarshalAditya_0-1692050356717.png

 

 

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

 

 

AndersBGS
Tera Patron
Tera Patron

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/