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

Neha8
Tera Contributor

I have a usecase where in I am trying to create vulnerable item records via api and for every row transformation a detection record is created for which the logic is set in OnAfter script. What do you suggest in this case.

@Neha8. in your case, you must use 'onAfter' script to create a detection record.  The 'onAfter' script will first query the detection table, which will typically have two columns (a) Detected Vulnerability sys_id and (b) Scan Description (eg: June 2025 Internal Scan).  If the query (based on these two parameters) returns false, insert a record.