Workflow conflicts with Logic Hooks

Scenario: I have module A (1-to-m) B (1-to-m) C & D.

When A is pre-existed, Workflow set up for when new B is created, C & D will be automatically created, the C & D name will be set to automatically equal to B’s name.

" before_relationship_add "Logic Hooks is set up for C & D module when related B record is pre-existed. For example, I want the name of C or D be automatically filled with the concatenated field from B when I create new C & D when viewing B’s detail view [so it knows the C & D’s parent is module B]

Issue that I found today is when workflow and logic hooks co-exists, when I create new B, the new C & D will not be auto created, I checked the workflow process audit, it says the corresponding B is running. When I get rid of all logic hooks I created, workflow is back to normal.

Could anyone shed me some light how to modify the code?

I never do that in workflow, but you have a sample in logic hook here :

In befor_save, the new record B is not created (no id), then you can’t relate C and D
With the solution (link above)… you pass id of the new B record to after_save hook and then you can create C and D and relate C and D to B.


1 Like

Thank you, I have been trying your suggestion but have not made it work yet.

However, I found something interesting and I don’t understand.


a “A” module record is pre-existed, I placed “after_retrieve” logic hooks in module B and when I created new B record from A’s sub-panel, B successfully retrieved and saved some data from “A” record.
I also placed “after_retrieve” and “process_record” in only C, and this time, workflow worked fine and no conflict, module C successfully retrieved some data from module B.

[physician_orders is another child of presc (C module), Job is parent of C]

BUT, when I continued to place logic hooks in D (or other child module of B.). The B module detail view won’t even display.

[physician is child of SCP (D module), SCP is child of B, which is Job (B module), this is an example I am grabbing child info for D module]

:silly: Could you shed me more light lol