remove mandatory field messages on change form

pujitha K
Tera Contributor

Hi Team 

 

I have requirement that during change new state we have to make Risk assessment fields mandatory Risk Fields are customized field on change

 

We have written Ui policy to make the fields mandatory during new state.

 

Now everything is working as expected but now client want now to remove all mandatory Risk Assessment field messages on top of the form instead of that we need to have only one single message that "Risk Assessment is mandatory"

 

Is there any option that to remove oob functionality and add customized message 

pujithaK_1-1765810534545.png

 

Please check and help me to proceed further on the requirement.

 

Thanks,

Pujitha

 

5 REPLIES 5

Ankur Bawiskar
Tera Patron

@pujitha K 

you can use onSubmit client script and check if it's an existing record, then only throw error

function onSubmit() {

    if (!g_form.isNewRecord() && g_form.getValue('state').toString() == '-5') {
        // add mandatory logic and show combined message
    }

}

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader