On-Complete Transform script

harishdasari
Tera Guru

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

7 REPLIES 7

Abhinay Erra
Giga Sage

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.


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


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();


harishdasari



Did you get this working?