Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

serial number populating on the incident form

chercm
Mega Sage

i tried to do a before br on the incident form . i have a field called u_impacted_asset so when i entered the caller infomation it should automatically populate the impacted asset box . it is not working now 

 

// Get the caller's username from the incident ticket
var caller = current.caller_id;

// Query the alm_asset table to find the asset assigned to the caller
var assetGr = new GlideRecord('alm_asset');
assetGr.addQuery('assigned_to', caller);
assetGr.query();

if (assetGr.next()) {
// Populate the u_impacted_asset field with the found asset's serial number
current.u_impacted_asset = assetGr.serial_number;
}

14 REPLIES 14

Kieran Anson
Kilo Patron

Hi,

Curious to why you're populating an asset record within Incident Management. Assets (generally) have a configuration item attached which should be populated in the configuration item field on an incident form

the business needs to have the CI for some thing else and a field for serial number @Kieran Anson 

That doesn't sound like a genuine need for a customisation, additional configuration items can be added to a incident via the Affected CIs related list

 

@Kieran Anson sorry i do not want to be rude . i do not understand why are judging on what you feel is a genuine needs or not. it is an opportunity of learning since Servicenow is a great platform for scripting.  it is my company needs and not yours. thanks