Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
-Solved- Workflow execution when saved by another workflow
The workflows are triggered when a record is saved most of the time. However, if the triggered workflow modifies(and saves) a field on a related module and another workflow is supposed to execute when something is saved in that module, the second workflow is not triggered, because it was 'indirectly' saved i suppose.
Is there a method to trigger workflows when a previous workflow was the one that 'provoked' the triggers instead of the user? To obtain a sort of cascading effect.
I remember i saw something like that in documentation examples but i can't find anything.

this is a delicate request as it can easily fall into an infinite loop and/or impact performance.

that said, there is a "Launch workflows on related updates" check box in the "update fields" workflow task that will permit you to do that.
Yes, I'm aware of the caveats.
I have a problem with the "Launch workflows on related updates" check box though. It is so generic i don't undestand how should it be interpreted: which workflows to launch and what are the related updates. My instinct is to understand it as: 'Launch the present workflow(that actually being the current task in the workflow) when a related element changes'. Right on the bat i feel that my instinct is wrong and it might be 'Launch some other workflows on some other related item when the present one changes' and so on. so it is unclear to me what workflow(s) are supposed to be executed and what exactly is the trigger... which are supposed to be the 'related updates'? And moreover - this checkbox is on a task, the workflow itself has another set of triggers that i'm not sure how they are supposed to be configured: on every save? on System. Mass Actions..?. I have checked the documentation and i definitely remember that i saw some example involving the use of that option it might have been a video but i think it was mainly about something else and this particular use was only a part of it anyways, i can't seem to find any examples now.
What i want to achieve is when a product is related with a subproduct i need to adjust the quantity in stock of the subproduct. That works ok but if the subproduct also have subproducts then those quantity in stock has to be adjusted too. That will not execute with the usual approach so I'm trying to figure out how to propagate that change in quantity.
ok. I see :-D

Let me try to shed some light.

I think the base concept to get here is that, by default, updates done by the workflow tasks DO NOT trigger the workflow system. That means that if you update a field on the record being saved (the one that triggered the workflow in the first place), there will be no further workflows launched on that record.

Let's suppose you are editing a Contact record, and update a field on that record. That update will not trigger the workflow system

Now, on the same contact record, you trigger an update workflow and update a field on the related Account. That update, on the account record, will NOT trigger a workflow.

Again, on the same Contact, but now with an Update Related Records task, the one that permits you to massively update fields on the related lists of records. Let's suppose you have a task that updates some field on all the invoices related to this contact. When that update happens, no workflow will be launched.

That is how the system works by default, it tries to avoid potential loops and slow performance for the UX. But, sometimes, you really need to launch workflows on those updates, that is where the checkbox comes in. If you are in a normal Update Field task and check the "launch workflows" then, in both examples above the workflows will be launched. They will be launched when the Contact record is updated and also when the account record is updated. If there are any workflows related to those modules that should be launched (their conditions are met) they will be launched.

For the Contact-Invoice example, each invoice that gets the update will launch the workflow system, the workflow system will look for all workflows associated to the invoice module and will evaluate the conditions and launch the tasks for each updated Invoice record. Just as if you had entered each one and edited it.

Now, all that said, and hopefully being a bit more clear, I have to ask if you have tried the global variables Product_SubProduct_CostRollUp and Product_SubProduct_PriceRollUp which are supposed to do that quantity update you are looking for. Are those not working as you expect?
Wow, was I offtrack with that ;). I get it now. It overrides that default behavior of NOT launching further workflows if changes were made by the system(workflow).
That brightened the room quite  nice ;). Although i got a bit confused, i think is an elegant way of trying to avoid odd mistakes.
For me, it works. I would understand it like this: Launch any workflow(all that would resolve true when saved by user) defined on the related module when present task updates something on that module.
The ProductComponent issue I experienced is described(quite badly here):
First the ProductComponent module does not register the table in the Products related tables, the existing Product Bundles related table - which is not a true representation of ProductComponent creates confusion, as described in the link ;). Anyways if i remove  Product Bundles and add ProductComponent in Layout Editor things start acting more normal BUT:
In the Product Component related list, the unit price and cost price of the 'toproduct' Product are not detected. Hence the price and cost rollup GV's cannot yield any number. So it is not working for me.
However, i can fill in those values in customfields upon every save with workflows, so costs and price can be correctly(to some acceptable degree) accumulated in those fields, picked up by the parent product and alter unit and cost price as needed. And I don't mind having the extra control of the procedure. But going the other direction(updating quantities after the relation has been saved) proved challenging if it has to go deeper than the first level ;).
There's also this strange behavior:
If the product component module has a workflow with a update task and you try to touch any field on 'from product' or 'to product' on let's say every save, the first time that the workflow will execute - which is when you save the initial relation- the GUI hangs and does not revert to the product page from where you added the product component relation, http service has to be restarted. The flow usually executes and does its updates but hangs after that. If it is triggered after the first save(you lose the moment of creation as a trigger) it works ok. This behavior is when i use 'add product component' button from the product's 'product component' related list.

Forum Jump:

Users browsing this thread: 1 Guest(s)