how to pop up a message right above the "Follow up Date" field in a PTASK when the field is updated

sai charan7
Tera Contributor

Hi can anyone help me with how to pop up the message above the field when the field is updated,

 

A message pops up right above the "Follow up Date" field in a PTASK when the "Follow up Date" is updated

Message: "Please contact Problem Management to modify the due date"

1 ACCEPTED SOLUTION

@sai charan7 Just add one more line in if block as below

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

if (newValue === '') {
g_form.showFieldMsg("follow_up", "Please contact Problem Management to modify the due date", "error");

g_form.setValue("follow_up", oldValue);
}
}

 

Please mark as correct answer if this solves your issue.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

View solution in original post

11 REPLIES 11

@sai charan7 Client script is working fine. Please try below code:

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

if (newValue === '') {
g_form.showFieldMsg("follow_up", "Please contact Problem Management to modify the due date", "error");
}
}

 

jaheerhattiwale_0-1670566742127.png

 

Please mark as correct answer if this solves your issue.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

iam getting alert thanks for it but i dont want to save the new value entered here, how to keep the old value only

@sai charan7 Just add one more line in if block as below

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

if (newValue === '') {
g_form.showFieldMsg("follow_up", "Please contact Problem Management to modify the due date", "error");

g_form.setValue("follow_up", oldValue);
}
}

 

Please mark as correct answer if this solves your issue.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

getting this error

onChange script error: RangeError: Maximum call stack size exceeded function () { [native code] }

iam getting this error

onChange script error: RangeError: Maximum call stack size exceeded function () { [native code] }