Extending workflow

Hey there.

I’m looking for opinions on extending workflows.

Goal: Generate job and job tasks from quote and line items when quote status is Accepted closed.

Situation: I’ve developed two custom modules Jobs and Job Tasks (simplified projects and project tasks). When quote status is set to Accepted then create a job using the quote detials (name, account description) and create a relationship to the quote. Then create job tasks from the quotes line items and create a relationship for each item to the job.

I’ve explored the workflow module and decided it can’t perform this level of complexity.

My questions are:

  1. Would the best approach be to use a logic hook on the AOW_Actions module to create a new action in the workflow module?
  2. Or create a logic hook for the Quotes module and use ‘after_save’?
  3. Or create an action in the Jobs module controller for example &action=generate_job &record_id=QUOTEID (probably my preferred approach)?

With option 3 I’d still need a way to trigger the controllers action after save.

This sounds like a perfect job for no. 2

That is the correct way to run complex code after a Bean event (save).

Thanks for your response pgr.

Do you have any thoughts on no. 3? A benefit of it in the Jobs module controller is that it can be triggered by a button. For example “convert quote to job”. I guess I could create a function file and import it into the logic hook and controller to reduce duplicate code.

create a function file and import it into the logic hook and controller to reduce duplicate code.

:point_up: exactly

1 Like

I agree with @pgr. AOW is powerful, but I think if you’re capable with php you can achieve exactly the desired outcome with tweaking controllers, logic hooks or schedulers much quicker than you can get about the same with AOW. So definitely create the functions once and just call them from both by necessary logic hooks and controller files - ie. combine 2 and 3.

Thanks TLi & pgr. I’m already on to it.