Need to populate Asset Serial number in service catalog variable

varma2
Mega Sage

Hi All,

 

 

Need to populate requested for assets in lookup variable in catalog.

 

we have a requested for variable  and  we need to get the value of requested for Assets serial number from the (Alm_hardware ) table to populate in  (serialnumber_varible ) lookup select box in catalog item.

 

Please suggest.

 

Thank you all.

 

 

28 REPLIES 28

@varma2 

if user has multiple assets then which one you want to populate in that lookup variable?

why not allow them to select the assets which are assigned to them since you will apply reference qualifier on that lookup?

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

Hi @Ankur Bawiskar 

 

After applying the reference qualifier  without selecting (requested_for)  few asset are populating, But not sure how they populates.

varma2_0-1688458656815.png

 

 

Please suggest.

@varma2 

advanced ref qualifier will filter it and client script won't allow user to select anything in 2nd variable unless 1st is having some value.

make the 2nd variable editable only when some value is selected in requested_for

write onChange catalog client script on requested_for and do that

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

	if(newValue === '')
		g_form.setReadOnly('serialnumber_varible', true);
	else
		g_form.setReadOnly('serialnumber_varible', false);
}

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

Hi @Ankur Bawiskar 

 

I have implimented above provided script. But serial number not papulating based requested for.

 

There are multiple serial number are populating instead of requetsed for  serial number.

 

Please suggest. 

@varma2 

can you share what script did you use along with screenshots?

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