On-Complete Transform script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2016 10:04 AM
Hi,
I have created On-Complete transform script, here values has to be stored from source table to custom table. But it is not inserting any records into the table after completion of the transform. can anyone please help me what's the wrong I am doing here.
var appname = source.u_aplctn_nm;
var year = source.u_rtb_cst_fctr_fy_nb;
var bde = source.u_bsns_dsrptn_elgbty_in;
var id = source.u_mega_aplctn_cd;
var gr = new GlideRecord('u_bde_and_fiscal_year'); // u_bde_and_fiscal_year is custom table
gr.initialize();
gr.u_application_name = appname;
gr.u_fiscal_year = year;
gr.u_bd_eligibilty = bde;
gr.u_correlation_id = id;
gr.insert();
if(gr.next())
{
id = gr.u_correlation_id;
gr.u_fiscal_year = year;
gr.u_bd_eligibilty = bde;
gr.u_correlation_id = id;
gr.update();
}
Thanks
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2016 12:23 PM
Hi Abhinay,
Yes it is working. Thanks for your help, but if I load all records once again and run transform map, it is inserting all the records again. If any values changes from source table and reprocess the transform map I have to restrict them to re-insert. Can u please post the code to update records if u_correlation_id(field) of table is same as existing record. Record should be updated, should not create a new record.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2016 12:30 PM
What is the unique key on the table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2016 12:40 PM
on source table unique key is u_mega_aplctn_cd. and in custom table it is u_correlation_id