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.

Callback function not being executed

Winston
Tera Guru

I'm trying to use the g_modal.showFrame in a UI action to update a record then after being close run a callback function. 

Kb0743790 says "callback Function will be called after modal is closed, with parameters: true if the user confirmed, and false otherwise." but my alert doesn't run after the model is closed out. What am I doing wrong?

https://hi.service-now.com/kb_view.do?sysparm_article=KB0743790

function onClick(g_form) {
	var url = '/sys_user.do?' + 
		'&sysparm_query=sys_id=' + g_form.getValue('caller_id') +
		'&sysparm_view=itil' + 
		'&sysparm_form_only=true';
	g_modal.showFrame({
		url: url,
		title: 'Update User Record',
		size: 'xl'}).then(function() {g_modal.alert('Check.');});
}
7 REPLIES 7

Hi,

somehow I was not able to test this out in my PDI

I created UI action with that script; it gave me this error

Uncaught ReferenceError: g_modal is not defined

Can you share how you have configured that?

Regards
Ankur

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

Hey sir, 

It works for me in Orlando without any configurations in a workspace client script.

 

find_real_file.png

 

 

hi @Winston ,

 

Probably you figure it out already but i was able to find solution

KamilSmusz_0-1690889357458.png