Alternate way to achieve GlideModal script in service portal

Lavanya Nagendr
Giga Guru

Hi All,

 

We have a client script for a record that will GlideModal a confirmation popup once the record is selected as "closed". Now, the GlideModal wont work for Service Portal. I have tried to replicate the same script and modified the script type as "Mobile/Service Portal" still it didn't work for me. In that case we need to opt for a custom widget. Kindly help me on how we can achieve it via a widget as i am new to Service Portal.

 

Client Script:

Type: OnChange

Field Name: Substate

UI Type: Mobile/Service Portal

 

 

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
	if (isLoading || newValue === '') {
		return;
	}
	var ajax = new GlideAjax('SP_AuditUtils');
	ajax.addParam('sysparm_name', 'getFieldValues');
	ajax.addParam('sysparm_id', g_form.getUniqueValue());
	ajax.addParam('sysparm_table', g_form.getTableName());
	ajax.addParam('sysparm_fields', 'state');
	ajax.getXMLAnswer(function(answer){
		answer = JSON.parse(answer);

		if(g_form.getValue('state') == 'closed' && answer.state != 'closed'){				
			var dialog = new GlideModal("sn_audit_finding_evidence_confirmation");	 
			dialog.setSize(560,480);
			dialog.setPreference('sysparm_finding_id', g_form.getUniqueValue());
			dialog.setPreference('sysparm_old_state', g_scratchpad.findingState);
			dialog.setTitle(new GwtMessage().getMessage("Auditor Evidence Confirmation"));
			dialog.render();
		}
	});

}

 

 

 

Thanks,

Lavanya

 

0 REPLIES 0