serial number populating on the incident form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 06:42 AM - edited 06-05-2024 06:42 AM
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;
}
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 09:08 AM
There a number of us within the community who strive to ensure excellence, the main reason being unnecessary customisations due to the complexities of the platform and not knowing what features are available (due to the amount, or the lack there-of documentation).
I'm questioning your requirement because it seems indicative of short-cutting the platform as an "easy win" that turns into quick technical debt. Populating a new field with a static update of a serial number rather than using the reference data model of ServiceNow is counter-intuitive in a lot of cases.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2024 02:54 AM
@Kieran Anson i am creating that impacted asset field to look up the asset as an input to the rest message api call to Dell to open a web ticket from Servicenow .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 08:40 AM - edited 06-05-2024 08:41 AM
Hi @chercm
I've tried something similar in the past and if the user has/had more than one asset against their name it wont populate, try narrowing your query so it can isolate a record;
var caller = current.caller_id.getDisplayValue(); //updated as reference field
var assetGr = new GlideRecord('alm_asset');
assetGr.addQuery('assigned_to', caller);
assetGr.addQuery('operational_status', 'operational'); //Example
assetGr.addQuery('type'. 'computer'); // Example
assetGr.query();
if (assetGr.next()) {
current.u_impacted_asset = assetGr.serial_number;
}
I dont have access to PDI at present so untested, let me know if it works... If not I'll give another crack at it later.
Please mark as helpful or if its resolved the issue, correct!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 09:36 PM
do you mean to put this in the BR ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2024 11:48 PM
@Andrew_TND if that user have more than 1 computer , will it not able to populate ?