IntegrationHub OnBefore script not working

DylanBlumenberg
Tera Contributor

Hi all,

 

I am using IntegrationHub to take an Excel file and transform the data to the Contract, Asset, and Assets Covered tables.

 

On the integration, I have a simple OnBefore script where if the Asset Type column on the Excel document is "Workstations" or "Notebooks", set the PO Number to "94904", but it does not work. I've looked at documentation for similar tasks and tried various iterations of this script but can't find a reason why this wouldn't work.

 

Why might this be?

(function onBefore(source, target, importLog) {    

    if(source.u_asset_type == "Workstations" || source.u_asset_type == "Notebooks")
        source.u_po_number = '94904';

})(source, target, importLog);

 

 

16 REPLIES 16

Please open this transformer definition record and you can add onbefore OR onafter script there
You need to check the field in that record and add the script this should work.


***Mark Correct or Helpful if it helps.***

Yousaf_0-1753956599284.png


***Mark Correct or Helpful if it helps.***

Hey @Yousaf, that's where I have the onBefore script located currently. I added it from IntegrationHub - Import, which is where I set up the import and mapping. 

DylanBlumenberg_0-1754071908532.png

 

Periyasamy P
Tera Guru

Set value on target not source. For ex, target.<target_column> = "94904", so that, it will be added to target record as you want.

 

Mark as helpful, if this resolves your issue.

Hi Periyasamy, I updated the target to "target.po_number = '94904';" but didn't have any success there. I also tried "target.u_po_number = '94904';". 

 

In an OnBefore script, is the target a staging table or would the target be the final table that the data is being imported to, in this case, ast_contract?