Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

onComplete transform script is not working as expected

d_kush
Giga Contributor

Hi,

I am working on Helsinki version of Service Now.

I have a scheduled job which imports data using REST message from some URL and stores in a staging table.

Then I am using a transform map to transform this data into target table.

Here is the issue, I need to delete records from target table which have not been updated from this import.

For this I have given an onComplete() transform form script which should delete unupdated data based on some filter query. but this script is not working as expected. As my understanding it should delete the data matching to filter condition after all the data has been transformed from staging to target table.

inplace of this, this script is deleting data before transformation.

I don't know what is going wrong with this script.

12 REPLIES 12

d_kush
Giga Contributor

Problem is with deleteMultiple() function.


It doen't work with dot-walking, if we give this function with dot-walk it won't check for the condition and it will delete whole table's data and that is what was happening , i think.



find_real_file.png


d_kush
Giga Contributor

Hi All,



There was problem with onComplete. I am using web service to import data. in Helsinki default mode of import set will be synchronous for webservice import. for Mode as synchronous, onAfter and onComplete transform scripts work same. onAfter transform script processes data one by one and check for script query.


Ideally onComplete script should check for script query once all the data has been processed, but as mode is synchronous when 1 row is transformed, onComplete starts running the script as it considers that all the data has been processed.



Thanks


Thanks a lot Deepti for sharing your finding!! Very much appreciated!