What is the difference between onAfter and onComplete transform script? I understandthat onAfter is after every row and onComplete is after entire transform but an examplecan be more helpful.

Chandler2
Tera Guru

  

1 ACCEPTED SOLUTION

Alikutty A
Tera Sage

@Chandler Your understanding is correct. You can have the following eg

OnAfter - It is almost similar to an onAfter business rule and you could use it to write any businss logic to be executed on other related tables. For eg when transforming users, you can add users to group or users with roles in an on After script. 

OnComplete - Once the entire list of rows are transformed, the onComplete script is triggerred. You could acccess the entire import set in here and process any required logic on the entire rows imported. Since transform map executes row by row, you cannot apply a logic if first row is dependent on the last row and similar logic can be accomplished using it. It can also be used for adding logs or triggering any emails after transform.

View solution in original post

6 REPLIES 6

Alikutty A
Tera Sage

@Chandler Your understanding is correct. You can have the following eg

OnAfter - It is almost similar to an onAfter business rule and you could use it to write any businss logic to be executed on other related tables. For eg when transforming users, you can add users to group or users with roles in an on After script. 

OnComplete - Once the entire list of rows are transformed, the onComplete script is triggerred. You could acccess the entire import set in here and process any required logic on the entire rows imported. Since transform map executes row by row, you cannot apply a logic if first row is dependent on the last row and similar logic can be accomplished using it. It can also be used for adding logs or triggering any emails after transform.

Thanks for responding.

But there are cases where it seems both can work then how to choose? Is there a good practice suggested?

For example: I imported records in a table and the state was open. Now I want to change th state to WIP. Now I have done it with onAfter but as per your suggestion I should have used oncOMPLETE as I want to update for all the rows.

So which is the best way to do it?

Is there a dependency on the other rows, where you need to update state of row 1 only if row 10 is present? If yes you could do it in the onComplete script but if you are just updating state of all rows to Open then you should place it in onAfter script as it is direct application of logic to the same row or record.

No dependency, update for all rows. 

Used onAfter.