on 2018 May 25 9:35 AM
Assume that there are three products P1,P2,P3. Single workflow should be created for all the three products, meaning single workflow will have 3 products as an attachments.
I tried creating workflow using AfterSaveListener when a new product is added or editing the existing product but it is creating the single workflow for each product. I mean, if there are 3 products then it is creating 3 workflows, not single workflow for 3 products.
Please help, how to achieve this ?
Request clarification before answering.
Hi,
in backoffice you can manually create a workflow with many attachments. If you want to react to events (like save) you have some options:
hook-in to the logic that does the bulk operation on the data (then you will have all the needed references)
react to the save events and store the data you want to attach + create a cron job to start the workflow from-time-totime
create a cron job that will be able to fetch the changed items to st wrkflow (the best option, no additional persistence needed)
Cheers, Wojtek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the suggested approaches.
Lets consider the 3rd approach, In my case, i will receive an impex file which contains list of products(say 20 products) and i have to trigger a single workflow for all the 20 products once the 20th product is imported. Here how i will be able to call the save event while importing the last product (how do i determine the product is the last product ?) .
I do have similar situation. I'm using 6.7 version. I want to trigger only one instance of workflow template for all 10 or 20 products. Below is the line of code I am using in impex file to trigger a workflow. But it triggers n instances of workflow template where n is number of rows in my impex file.
"#%groovy% afterEach: workflowService.createWorkflow(workflowTemplateService.getWorkflowTemplateForCode('wfl_template_name'), modelService.get(impex.lastImportedItem))"
Please let me know if there is a way with which we can achieve this. Just like "afterEach" is there a method "äfterLast". Please suggest.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.