How to populate string field value from one table to another table reference field value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2022 02:45 AM
Hi There,
There is cmdb_ci table and class is compute and I took any random record and as per screenshots there is name field value. You can see that. so that value I want to populate on hardware table there is configuration item reference field there I need to populate. I have existing BR and I checked there is need to do some change but I did it but it's not working please help me on this. I have provided the script below
below script
var as = new GlideRecord('alm_asset');
as.addQuery('sys_id',current.asset);
as.query();
if(as.next()){
as.install_status = current.install_status;
as.u_secondary_or_support = current.u_secondary_or_support;
as.u_offline_device = current.u_offline_device;
as.u_model_number = current.model_number;
as.u_last_altiris_feed_date = current.u_last_altiris_feed_date;
as.u_last_altiris_feed_id = current.u_last_altiris_feed_id;
as.ci = current.name;
as.insert();
as.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2022 04:49 AM
Please look in system logs for message containing:
CI DEBUG, found a record
Does it have one?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2022 03:23 AM
OOTB, they are already in sync so why you are populating it?
asset field and alm_hardware are already in sync with configuration item
Also
The configuration item on alm_hardware table is read only when creating a new record.
When you create a new record on alm_hardware, a new CI is already created and when you change the name on CI itself, it will reflect on hardware record the same due to OOTB BR syncs
Anshu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2022 03:24 AM
i think that could be the reason , your script may not be working
Anshu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2022 03:25 AM
Yeah that is correct but when create new record then configuration item field should populate the record name other things are sync but this thing I have to sync
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2022 03:41 AM
This is also OOTB done.
when you update the CI name on computer form, the name will be displayed on hardware CI field
just try in any PDIs
Anshu