Auto populate fields on pop-up window

NAIDILE S
Tera Contributor

Hi All!

Here on the pop-up based on CI i need to fill the other service, application service and service offering fields and save it on incident form.
How do i do that ? can anyone help me with this.
Thank you

NAIDILES_0-1694597781822.png

 

1 ACCEPTED SOLUTION

@NAIDILE S 

you want to auto-populate then make the fields readonly on UI page.

if you want to auto-populate and also allow user to select other value then check this link how to set reference field on UI page when UI page loads

check this link and enhance as per your requirement

Store value in reference field of ui page using client script 
If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

12 REPLIES 12

@NAIDILE S 

in out of the box UI page I could see only these fields.

Seems your UI page is customized

AnkurBawiskar_0-1694605050173.png

 

Do this as I mentioned. I did it in Create Problem UI action. You can update yours one

function ShowToCreateProblem() {
    var sysId = g_form.getUniqueValue();
		var title = getMessage("Create Problem");

		// use GlideAjax here and get the service, application service and service offering field values by passing the CI value to script include
	
		// then set those in preferences and update your UI page to populate it
	
		// since you want to auto-populate the service, application service and service offering fields on UI page why not make them text type and readonly and not make them reference type	
	
		var dialogClass = GlideModal ? GlideModal : GlideDialogWindow;
		var dd = new dialogClass("sn_si_create_prb_change_inc");
		dd.setTitle(title);
		dd.setPreference('sysparm_sys_id', sysId);
		dd.setPreference('sysparm_action', "problem");
		dd.setWidth(500);
		dd.render();

}

 

AnkurBawiskar_1-1694605181681.png

 


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

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

@Ankur Bawiskar 
Thanks...
and also say CI is not filled and later while pop-up they need to fill the service application and so at that time , how shall i give the condition in this case

@NAIDILE S 

you want to auto-populate then make the fields readonly on UI page.

if you want to auto-populate and also allow user to select other value then check this link how to set reference field on UI page when UI page loads

check this link and enhance as per your requirement

Store value in reference field of ui page using client script 
If my response helped please mark it correct and close the thread so that it benefits future readers.

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