We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to get alert/warning message (alert message) when manager approves after planned start date

Vinod S Patil
Tera Contributor

Hello Everyone,

I have below requirements, please suggest me

> Create warning message when manager approves after planed start date/time.

 

 

@Sandeep Rajput 

@Community Alums 
@Mark Manders 

@

5 REPLIES 5

Mark Manders
Giga Patron

Please don't tag people in questions!


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Not applicable

@Vinod S Patil use g_form. addErrorMessage('message');

 

…………………………………………........................................................................................
Please Mark it helpful 👍and Accept Solution !! If this helps you to understand.

…………………………………………........................................................................................

@Community Alums  
 g_form. addErrorMessage('message'); it will be in the loop but before that what condition we need to add in client script.

Not applicable

@Vinod S Patil Try BR

if (current.approval == 'approved' && new GlideDateTime().getNumericValue() > new GlideDateTime(current.planned_start).getNumericValue()) {
gs.addErrorMessage('Warning: The approval is after the planned start date/time.');
current.setAbortAction(true); // Prevents the approval from proceeding
}