how to make a field mandatory after it goes for approval

Matt J Thomas
Tera Contributor

I have a request where when a manager approves a change request, a mandatory field must be filled out by the manager. I have no idea on how to do that. I can set the field to mandatory at any other stage but how can I make it so that once the manager approves the request, they must enter a value in the field. Many Thanks in advance for your feedback.

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@Matt J Thomas 

mandatory field on Change request?

If yes then why would approvers enter data in CHG form?

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

Danish Bhairag2
Tera Sage
Tera Sage

Hi @Matt J Thomas ,

 

One way of doing it would be to modify the approval widget in the portal in a manner wherein once the approver presses the approver button a pop up can come similar to when reject button is pressed for entering the comments on the portal.(This recommendation is specific to portal).

 

But this would require cloning & customising the approval widget as per your need & condition specific.

 

Thanks,

Danish

 

Tai Vu
Kilo Patron
Kilo Patron

Hi @Matt J Thomas 

Is the field on the Change Request table? If that is the case, you can create an OnSubmit Client Script to do the validation and display a message to tell the approver go to the Change Request to fill in the information.

 

Cheers,

Tai Vu

Can you please be more specific to this regard? Yes the field is on the Change Request Table. I believe your solution may work. 

 

Here's a sample of what I am thinking based on your feedback:

function onSubmit() {
//Type appropriate comment here, and begin script below
var w = g_form.getValue( 'u_scheduled_for_release' );
var approval = g_form.getValue('approval');
if ('approval' == "Approved" || 'w' =="")
alert ('Please enter a value in the Scheduled for Release field');
}

Thank you