Problem Description: Suppose, we have a scenario where we are taking the employees data as a rest trigger and writting for each employee one by one to a database table. Here, if any employee data gets errored out then what will happen, the process will be stopped from the moment and other employees will not be inserted to Database.
What we can do so that all valid data employees to be inserted into database table irrespective of any failure for an employee invalid data. The invalid employee data can be discarded and stored to a csv file and do a mail to business.
Solution:
We can follow the below 2 steps to achieve this requitement:
Step1: Take a scope inside the FOR EACH loop and insert the data into db.
Testing:
Scenario: Tested with 3 employees where 1st employee has invalid department data which exceeds the actual size.
No comments:
Post a Comment