Setting Field to Mandatory Based on Record Lifecycle

KinserIsaac
Tera Contributor

Hello! 

 

I have a requirement where I have two fields on the Risk form that I want to be mandatory ONLY after the draft stage.

So, when a user fills the form out, they aren't required to fill in that specific field when it is just in draft. Once the risk is saved ad moved into the assess stage, the field IS mandatory, and the typical error message pops up if they don't fill in the field.

 

Haven't figured out a way to do this. 

 

Thank you! 

1 REPLY 1

KinserIsaac
Tera Contributor

I actually managed to figure it out on my own.

 

Wanted to share my solution to help others in the future. 

 

I created a UI policy with condition of: State is Not Draft. 

Then for the script just a simple setMandatory 

function onCondition() {
        g_form.setMandatory('field_name', true);
       
}