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

Hi @Yousaf, I have more info from your suggestions. 

1. I'm finding that the IntegrationHub import uses the table global_ihub_import_e86a72c73b1a2650e7aa2f2eb3e45a7a, which does not have any transform maps associated with it. 

DylanBlumenberg_0-1753896458041.png

 

2. In the Asset Type column on the Excel file, there are no extra whitespaces. In the script, the values of Workstations and Notebooks have been copied right from the Excel file, so no case sensitivity issues either. 

 

I added some logs to the script (below) and they are evaluating true, which leads me to believe that the issue is with the target. 
2025-07-30 12_25_35-Log _ ServiceNow and 9 more pages - Work 2 - Microsoft​ Edge.png

 

3. The PO Number field name on the ast_contract table is po_number, so I updated the script target line to read "target.po_number = '94904';".

 

4. From what I can tell, the import is running as my account which has full admin. 

 

(function onBefore(source, target, importLog) {
    gs.log("Asset Type:" + source.u_asset_type);
    
    if (source.u_asset_type == "Workstations" || source.u_asset_type == "Notebooks") {
        target.po_number = '94904';
        gs.log("Condition evaluated true");
    }

    else {
        gs.log("Condition evaluated false");
    }
})(source, target, importLog);

 

I tried the OnAfter script and also added logs to it. The condition is evaluating true again, but the records PO Number fields are still not updated. 

DylanBlumenberg_1-1753896794646.png

 

DylanBlumenberg_2-1753896798620.png

 

I believe you need to create transform map between staging and target table and use the script there in transforming stage.
Please try that

 

 

 


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

It appears the TEMP ETL Entities aren't tied to a table.

DylanBlumenberg_0-1753907289714.png

 

I attempted to make a transform map between the source table and the target table and it wouldn't let me, with the following error.

DylanBlumenberg_1-1753907405210.png

 

Ouh this is robust transform...... 

Try this table (sys_rte_transformer) find your transformer Dell LAR....

And try adding your script before transforming stage 

 

I am not able to try any of these since i am in a waitlist to get my PDI......


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

That table doesn't exist in my instance but on the Robust Import Set Transformer page, there's not a way to add a script.

DylanBlumenberg_0-1753911023908.png