On incident form: when user with VIP = true is selected as caller in the incident, then addFielMessage to Caller field saying “This user is VIP”. Remove the message if Caller is changed then to empty or not VIP

Emmanuel26
Kilo Expert

On incident form: when user with VIP = true is selected as caller in the incident, then addFielMessage to Caller field saying “This user is VIP”. Remove the message if Caller is changed then to empty or not VIP

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Emmanuel 

update as this and check once

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
	if (isLoading || newValue === '') {
		return;
	}

	g_form.hideFieldMsg('caller_id');
	//Type appropriate comment here, and begin script below
	g_form.getReference('caller_id', function(gr) {
		if (gr.vip.toString() == 'true') {
			g_form.showFieldMsg('caller_id', 'caller is VIP', 'info');
		}
	});
}

Regards
Ankur

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

View solution in original post

6 REPLIES 6

Upender Kumar
Mega Sage

you can create onLoad client script and if caller is VIP you can write script

Ankur Bawiskar
Tera Patron
Tera Patron

@Emmanuel 

update as this and check once

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
	if (isLoading || newValue === '') {
		return;
	}

	g_form.hideFieldMsg('caller_id');
	//Type appropriate comment here, and begin script below
	g_form.getReference('caller_id', function(gr) {
		if (gr.vip.toString() == 'true') {
			g_form.showFieldMsg('caller_id', 'caller is VIP', 'info');
		}
	});
}

Regards
Ankur

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