The CreatorCon Call for Content is officially open! Get started here.

How to populate string field value from one table to another table reference field value

ak49
Tera Contributor

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

image

find_real_file.png

image

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();
}

 

9 REPLIES 9

Please look in system logs for message containing: 

CI DEBUG, found a record

 

Does it have one?

Anshu_Anand_
Kilo Sage

OOTB, they are already in sync so why you are populating it?

find_real_file.png

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.

find_real_file.png

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

Regards,
Anshu

i think that could be the reason , your script may not be working

Regards,
Anshu

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 

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

Regards,
Anshu