After Create event not triggered when using excel importer

3
I am using the excel importer and it appears that the after create events are not triggered. Is that right? If so, is there a workaround?
asked
1 answers
5

Yes that is correct. The excelimporter uses create batches for new objects. Just like XML import, the db import module, or create batches in Java your events won't be executed.
(after/before commit won't be executed either)

Is there an real simple way to work around to trigger those events anyway, no not really. In order to be able to use those events a traditional create/commit has to be used. This will make the importer about 40/50 times slower than it is right now.

There is a solution to process your objects after your import. The solution is to retrieve the object you have just imported and call the after create or commit microflows yourself.

How can you retrieve the objects you have just created?
You should use the 'import object parameter', using this parameter it is possible to create an association between each object you imported and the importObjectParameter.
In your domain model you have an object: ExcelRow  you want to use an after create event on the row object. So in order to realise this you should an another object to the model: ExcelSheet and your should create an association from ExcelRow to ExcelSheet. 1 .. *

Now deploy your project and sync modelreflection. In your template you can select an association in the property: 'Reference to import objects' select the association you have just created: ExcelRow_ExcelSheet and save the template

Now go back to the modeler and open your import flow, in that flow you should create a new ExcelSheet object and pass this new object to the import Java action (in the parameter importObjectParameter). If you trigger the import the excelimporter will import the excelSheet create new ExcelRow objects with an association to the ExcelSheet object.

Now all that needs to be done is to trigger the event flows.
In your import flow after the import java action, add a retrieve activity which retrieves all ExcelRows associated to the ExcelSheet object. This retrieves all objects you have just created. Iterate over these objects and execute the microflows that normally would have been executed during the specific events.

answered