Forum OpenACS Q&A: Workflow question

Posted by Tom Jackson on

I am working on an ecommerce module for OACS4.5. I haven't looked at workflow yet, but I have a question about how this works. Right now I have a series of states that an item can be in. The transition from one state to another caauses a trigger to activate to determine if something financially interesting happened, and to log the change.

The problem is that the financial question seems to be not easily tied to a specific point in the item workflow. I just had a concept that workflow is maybe not quite right for what I am looking to do. What if a customer negotiates to not be charged until a certain point in the process, can workflow deal with this?

As an alternative to workflow, I was thinking of an action based model. Actions might be:

  • Charge customer for item
  • Ship order
  • Return item
  • Refund for item
  • Email order status
  • etc.

Is this different from what workflow provides?

Posted by Don Baccus on
<blockquote><i>What if a customer negotiates to not be charged until a certain point in the process, can workflow deal with this? </i></blockquote>
One way to do this would be to assign a different workflow for this case that doesn't trigger your "Charge customer for item" action until that point in time.  Or has that step at that point in the process.
<p>Or you can model it in the workflow but do keep in mind that being able to attach one of any number of arbitrary workflows is one of the advantages of the system.
You should read the background papers referenced by Lars's documentation on workflow, which discusses the application of Petri nets to business processes such as you describe.
<p>Workflow helps out with quite a few things, including firing off notifications.  It relies a lot on PL/SQL callbacks.  It's not well-integrated with permissions.  There's no type/scope component to workflows themselves so there's no way to say "Tom's workflows can only be applied to Tom's ecommerce objects and objects derived therefrom" or whatever.
<p>I could go on and on with weaknesses - it is, as Lars has said more than once, an unfinished work.  It explores new ground and not surprisingly some of that ground is rough and broken ...
Posted by Jun Yamog on
Off Topic.

It is this lack of permission awarness that ACSJ uses to have
permissions.  Basically it uses workflow to control the access of
what users would do. :)  Makes you wonder which systems (OACS or
ACSJ) will have the quicker results in permissions.

Posted by Kevin Crosbie on
I've been using the workflow system for a few months now and I would imagine that it would be ideal for doing something like an ecommerce module if you define the whole process as a state diagram taking into account all possible situations.

If you want to handle things like when a user should be charged, you could just use the workflows attibutes and test this attribute at each stage where payment would be due.

Alternatively, you could code your pl/sql callbacks to check other tables like ec_orders before doing something like a credit-card transaction and set that table with the stage where transaction should be performed when the user is creating the order.

Hope this helps.