You are here: Home / Documentation / How To's / How to make a workflow application entirely through the web

How to make a workflow application entirely through the web

by nguyen — published Sep 22, 2010 01:05 AM, last modified Aug 16, 2016 10:50 AM
How to use PloneFormGen, uwosh.pfg.d2c, uwosh.northstar, and placeful workflow to make a workflow application through the web

Here we describe one way you can create a custom content type and assign it a workflow entirely through the web.  This method uses

  • PloneFormGen, to mock up your custom content type
  • uwosh.pfg.d2c, to create Plone objects for each form submitted
  • Placeful Workflow (CMFPlacefulWorkflow), to apply a custom workflow to the Plone objects created on each form submission
  • uwosh.northstar, to create a custom workflow using an easy-to-use GUI

The overall method

  • install the products (PloneFormGen, uwosh.pfg.d2c, uwosh.northstar, and CMFPlacefulWorkflow) into your site
  • create a form
  • add a D2C "saved data adapter" to the form (and enable it)
  • create a custom workflow
  • create a workflow policy
  • assign the new workflow policy to the D2C saved data adapter

Detailed Steps

Install the products

  • Using the ZMI and portal_quickinstaller, add PloneFormGen, uwosh.northstar, uwosh.pfg.d2c ("PloneFormGen Save Data to Content"), and CMFPlacefulWorkflow ("Workflow Policy Support")

Create a form

  • Use PloneFormGen to create a form that contains all the fields the way you want them to be in your custom content type

Add a D2C saved data adapter to the form

  • In the form folder, add a new "Save Data to Content Adapter".  Give it a name (e.g. "D2C" - it doesn't matter what you call it), leave the checkbox "Avoid Security Checks" checked, save it.
  • In the form folder, check the box to enable the new Save Data to Content Adapter 

Create a custom workflow

  • Using North* and its Workflow Designer Site Setup configlet, create a custom workflow for your mocked up content type

Create a workflow policy (Method 1)

  • In Site Setup, Placeful Workflow configlet, create a new workflow policy, and in the Default Workflow widget select the custom workflow you created with North*
  • Using the ZMI, go to portal_placeful_workflow, click on your newly created workflow policy, and in the field next to "FormSaveData2ContentEntry" enter "(Default)", press the Change button
  • Need to explain use of ZMI and portal_placeful_workflow to add a new policy because the Site Setup Workflow Policies configlet won't work for this.

Create a workflow policy (Alternative Method 2)

  • Using the ZMI, go to portal_types, FormSaveData2ContentEntry, check the box "Implicitly addable?".
  • In Site Setup, Placeful Workflow configlet, create a new workflow policy, and in the Default Workflow widget select the custom workflow you created with North*.  Next to FormSaveData2ContentEntry use the drop down list to select your new custom workflow

This method is slightly easier than Method 1 but leaves a (slightly confusing) "FormSaveData2ContentEntry" choice in the "Add New" drop down menu throughout your site.  Your users may not understand what this choice does, and they should avoid using it.

Assign the workflow policy to the D2C saved data adapter

  • Navigate back to your form
  • Use the "state" drop down menu and choose "policy..."
  • Select your new workflow policy for both the "here" and "below" levels

Test the form

  • Fill out the form and submit it.
  • In the navigation portlet, click on your D2C saved data adapter.
  • The D2C should contain a new item: the form and the values you'd filled out.  Click on the item.  Check that its state is the initial state of the custom workflow you created.  When you click the state drop down menu, you should see the available transition(s) you specified in your custom workflow.


When to use D2C vs. a fully fledged Python Product

When does it make sense to use uwosh.pfg.d2c? 

The short answer: 

The D2C product is intended for *simple* workflow applications only.  

A slightly more verbose answer:

By "simple", think of a paper form that you fill out; instead of it being on paper, it would be on a Plone site.  It wouldn't do anything particularly smart other than its contents being stored and queryable and retrievable through the Plone site.

A more techy answer:

Only for simple workflows that do not require custom field/attribute behaviour.  

An example of custom field behaviour would be a requirement that if the value of a particular field is greater than 50 a different email message should be sent than if the value is less than 50.  

Another example of custom behaviour that must be programmed: if you required that different sets of fields be visible and/or editable by different roles at different workflow states.

If you require such custom behaviour, you should use North*'s Workflow Generator to generate a file system product and add your custom code to it.  [discuss how to add custom code in such a way as to be able to go back to the PFG mockup to modify the content type and regenerate the fs product and be able to re-add the custom code most easily].