Transform Map - How to delete data from the target table not in the source table?

Yuri____
Tera Contributor

The source table contains only the latest information, while the target table contains both the latest and old information.
How can I extract and delete the old information from the target table?

4 REPLIES 4

Sandeep Rajput
Tera Patron
Tera Patron

@Yuri____ Data is usually imported in the import set tables first. You can use an onComplete transform script to compare data between your target table and import set table on the basis of a key field and choose to delete the data which doesn't exist within the target table.

 

Hope this helps.

AshishKM
Kilo Patron
Kilo Patron

Hi @Yuri____ , 

You can configure the transform map for delete operation as end to process using the onComplete Script.

As per transform map script the onComplete will executes at the end of an import after all rows are read and transformed.

 

Refer : Transform Event Scripts

 

You need to consider the variable ( or flag ) on target table which can segregate the latest and old records, if that flag is updated on today's date ( or true/false ) type then onComplete script can read and delete those records at end which are not updated ( flag ) by current execution.

 

AshishKM_0-1738204766757.png

 

 

-Thanks,

AshishKM

 

 

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Ankur Bawiskar
Tera Patron
Tera Patron

@Yuri____ 

It's not recommended to delete the target record

your data import will insert or update based on coalesce in your field map.

If the source fields has latest then it will get updated on target and you need not worry

how are you loading the data?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Yuri____ 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader