Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Field Message does not display in SOW

Justin Scheich
Tera Guru

I have a functional client script that shows the field message in the classic UI for the SOW view. However, it does not show in the workspace. What am I missing here?

 

function onLoad() {
	//Don't waste an ajax call if the caller is empty
	if (g_form.getDisplayBox('caller_id').value == '')
		return;
	
	//If we're closed, don't query
	if (g_form.getValue('state') == 7)
		return;
	
	var ga = new GlideAjax('LCGIncCheck');	
	ga.addParam('sysparm_name', 'getCallerIncidents');
	ga.addParam('sysparm_caller', g_form.getValue('caller_id'));
	ga.addParam('sysparm_num', g_form.getValue('number'));
	jslog("Calling LCGIncCheck for caller...");
	ga.getXML(doAlertCaller);
}

function doAlertCaller(response) {
	var answer = response.responseXML.documentElement.getAttribute("answer");
	
	jslog("LCGIncCheck for caller answer is: " + answer);

	if (answer != '' || answer != null) {
		g_form.showFieldMsg('caller_id', answer, 'error',true);
	} else g_form.hideFieldMsg('caller_id', true);
}

 

1 ACCEPTED SOLUTION

Justin Scheich
Tera Guru

I was able to find the solution; The script included does work without a change. It would appear that 

if (g_form.getDisplayBox('caller_id').value == '')

is not supported in the workspace and instead needs to be. 

if (g_form.getValue('caller_id') == '')

 

View solution in original post

6 REPLIES 6

Ramachandran
Tera Contributor

Hi Justin Scheich

 

Same requirement i have, but it needs to only work on my SOW workspace , not in Native UI.

What should i do ? Can you please suggest.

 

Hello, 
If you need a client script to only work in SOW un-check the global check box and update the view to sow. 
This will have the client script only run in Service operations workspace. 

JustinScheich_0-1738347184985.png