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 10:09 AM
it should go in an onAfter script not oncomplete. onComplete will be executed after all the rows are transformed. so you will not have access to individual rows.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2016 10:15 AM
Hi Abhinay,
Thanks for your response, the code which I have written is correct ?, or do I need to change anything it.
If I execute as On-complete script do I need to change anything in code ?
could you please let me know.
Thanks once again

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2016 10:36 AM
here you go. Make sure the target and source field types are same
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();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2016 11:37 AM