Script include sysparm

Indira8
Kilo Sage

Could someone please help me explain  what is sysparm_serial in the following script:

 

checkAssetSerial: function() {
var sno = this.getParameter("sysparm_serial");
var gr1 = new GlideRecord('alm_hardware');

gr1.addQuery('serial_number', sno);
gr1.query();
if (gr1.next()) {
return true;

} else {

return false;
}

 

Thank you 

9 REPLIES 9

vkachineni
Kilo Sage
Kilo Sage

It is the parameter name that a ajax client script sent to the function.

Please refer to client script and ajax calls.

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

Hitoshi Ozawa
Giga Sage
Giga Sage

It's a custom name (i.e. non-ServiceNow default) of a parameter that the developers of the script named to get a value of a serial number to query hardware asset table. If the serial number already exists in the hardware asset table, the function will return true. Otherwise, the function returns false.

Client script will call function checkAssetSerial() by setting this parameter.

.addParam('sysparm_serial', <serial number of hardware to check>);

Hi @Hitoshi Thank you for the detailed explanation.I actually need help for one condition to check whether the logged in user is a deputy (list field) or escalation contact of a particular group (it is not group table but custom table ) then catalog item variable should be visible to that user on the form. Could you please help me with the code,. I am not getting it Thank you

hi @Hitoshi Ozawa  Thank you for the detailed explanation. I actually need help for one condition to check whether the logged in user is a deputy (list field) or escalation contact of a particular group (it is not group table but custom table ) then catalog item variable should be visible to that user on the form. Could you please help me with the code,. I am not getting it

 

Thank you