How to get sysid of inserted record from transform map

Raviteja K
Tera Expert

I have a single staging table for 2 different tables and 2 transform maps. I need a way to get sysid of the record inserted through transform map for the first table and use it for second table. Is there a way I can achieve it?

 

Thank you 

4 REPLIES 4

Umesh Dubal 171
Tera Contributor

Hello  Raviteja K

 

Write a query within the script field to retrieve the relevant record from the staging table and fetch the sys_id. Your script may look similar to this:

 

var grStaging = new GlideRecord('your_staging_table_name');
grStaging.addQuery('some_identifying_field', source.some_identifying_field);

// Use a field to match records
grStaging.query();
if (grStaging.next()) {
target.u_reference_to_first_record = grStaging.source_table_sys_id;
}

Hi Umesh

I need to retrieve sysid of the record that got inserted by transform map. For example sysid of the user record that got inserted from excel sheet data.

Aman Kumar S
Kilo Patron

Hi @Raviteja K 

What is the exact use case, probably that provide more insight towards fixing your issue.

 

Best Regards
Aman Kumar

Hi Aman

We receive invoice and invoice lines data in the form of excel. First we need to insert invoice record and later invoice lines record and update invoice record in that invoice lines record.