g_form.DisplayBox('') is not working in the portal

Rama Rao
Tera Contributor

Hi All,

Actually, I need to get the value of the reference field. So I am using 'g_form.DisplayBox('')' but it not working in the portal and gives a javascript console error.

Can anyone help me with that?

Note: The field refers to the Service offering table and I need to auto-populate the service offering name in another field.

7 REPLIES 7

Rama Rao
Tera Contributor

I need to populate the field in the Catalog item form of the service portal

Hi,

 

Try using g_form.getReference() with callback function.

@Rama Rao 

onChange() Catalog Client Script on Reference variable

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
	
	g_form.getReference('<reference_variable_backend_name>', callBack);
}

function callBack(gr){
	alert(gr.getDisplayValue());
	g_form.setValue('<backend_name_of_other_variable>', gr.getDisplayValue());
        
        // If other variable is also reference type then you can utilize below line
	//g_form.setValue('<backend_name_of_other_variable>', gr.sys_id); 
}

 

Shubham Verma1
Tera Contributor

Hi @Rama Rao ,

 

We can use g_form. getDisplayValue(); on client side.

But condition is that "isolate script" checkbox set to false, it will not work when this field box set to true.

 

Mark Correct or helpful if it helps.

 

Thanks,

Shubham Verma