Client Script not working on Portal

Jeannette2
Tera Guru

I have a Client Script that works on Desktop but not the Portal.  I have tried it by setting UI Type to All and to Mobile / Service Portal.

I have also setup 2 Catalog Data Definitions that does the same thing as the Script but again it works on Desktop but not Portal.

Has anyone come across this?  Myself and a colleague have tried and looked at everything possible but still can't get it to work.

 

1 ACCEPTED SOLUTION

Hi,

GlideRecord won't work on portal and hence it's not working.

please use onChange with getReference callback and it will work in Native + Portal

function onChange(control, oldValue, newValue, isLoading) {
	if (isLoading) {
		return;
	}

	if(newValue == ''){
		g_form.clearValue('team');
		g_form.clearValue('department');
	}

	if(oldValue != newValue)
		var ref = g_form.getReference('name_of_new_starter', callBackMethod);
}

function callBackMethod(ref){
	if(ref.department)
		g_form.setValue('team',ref.department);

	if(ref.title)
		g_form.setValue('department', ref.title);

}

regards
Ankur

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

View solution in original post

7 REPLIES 7

@Jeannette 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

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

@Jeannette 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

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

@Jeannette 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

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