Compare two table and get missing record

Kaka Nayeem
Tera Guru

Hi Team,

 

We have two table custom table Job family and Approval table

Job Family

Job Family
IT
HR
Sales

Approver Table

Job FamilyUser
ITAbel Tuter
SalesBeth Anglin

 

i want script which will compare two table and print HR data from Job family table.

 

Regards,

Kaka Nayeem

1 ACCEPTED SOLUTION

Try this.

 

var jf= new GlideRecord('<job Family Table>');
jf.query()
while(jf.next()){

var gr2 = new GlideRecord('<approval family table>');
gr2.addQuery('<job family field on approval table>', jf.name);
gr2.query();
if(gr2.getRowCount() = 0}
gs.addInfoMessage('found item: ' + gr2.<job family field on approval table>);
}
}

 Add correct table and field names 

-Anurag

View solution in original post

3 REPLIES 3

Anurag Tripathi
Mega Patron
Mega Patron

What is the volume of data in each table? how big can they get?

-Anurag

its Around 50-75

Try this.

 

var jf= new GlideRecord('<job Family Table>');
jf.query()
while(jf.next()){

var gr2 = new GlideRecord('<approval family table>');
gr2.addQuery('<job family field on approval table>', jf.name);
gr2.query();
if(gr2.getRowCount() = 0}
gs.addInfoMessage('found item: ' + gr2.<job family field on approval table>);
}
}

 Add correct table and field names 

-Anurag