How to move one table of related list records into another table of related list table

chanikya
Tera Guru

My request is: i would like to see software installation records under  Computers(cmdb_ci_computer)  table of related list table Software installations....

 

In Both tables - Related list table is same (software installation)

Condition: computer table of record name and Arrived computer of record name if it match then only move related table records from Arrived computer table related record's.. 

howcan i do it..

My script is not working....Schedule Jobs

var comp = new GlideRecord('cmdb_ci_computer');
comp.addQuery('u_computername',current.sys_id);
comp.query();
while(comp.next()){
var arc = new GlideRecord('u_arrived_computers');
arc.addQuery('name',comp.name);
arc.query();
if(arc.next()){
var soft = new GlideRecord('cmdb_sam_sw_install');
soft.addQuery('u_computername',arc.sys_id);
soft.query();
while(soft.next()){
gs.log(soft.getRowCount());
soft.u_computername= comp.sys_id;
soft.update();
}
}
}

Here , if you click on computer name it is navigated into Arrived computer table..

find_real_file.png

 

find_real_file.png 

 

 

i wanna see installations record under computer record

find_real_file.png

 

 

if you wanna more information i can explain you clearly .....

please help me here, where i am going wrong here

1 ACCEPTED SOLUTION

So every time you insert or update  computer, it will query the software installation table with computer name field in software installation same as the name of the computer you are creating.

 

var software = new GlideRecord('cmdb_sam_sw_install');
software.addQuery('u_computername.name',current.name);
software.query();
while (software.next())

{

// If it finds the records, it will update the existing archived computer name with the new computer name
software.u_computername = current.sys_id;
software.update();
}


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

33 REPLIES 33

If a record in software installation exists with same serial number 3802LC2, it should not allow to create. So it is working fine


Please mark this response as correct or helpful if it assisted you with your question.

Software installation table had lot of serial numbers aroundly 32,340... From the list this bulk numbers I have taken one serial number HJ5LW3 and created one record in Computer table, FIRST time it should create a record, but second time if I tried to create a record in computer table with same serial number HJ5LW3 then it should accept, because already we create one record with that HJ5LW3.

I have created new thread for this..can you look into that please https://community.servicenow.com/community?id=community_question&sys_id=64cc2647dbfd1b002328f3231f96193e

 

 

Software installation table had lot of serial numbers aroundly 32,340... From this bulk serial numbers 32,340,. ... i have taken one serial number HJ5LW3 and created one record in Computer table, FIRST time it should create a record, but second time if I tried to create a record in computer table with same serial number HJ5LW3 then it should accept, because already we create one record with that HJ5LW3.

 

 

 

We are taking serial number from installation table and creating record in computer table, in case if we tried to create a record second time with same serial number in Computer table then it should give warning message, and should not create an record

can i expect any updates please