Assign Workflow for a view

Is is possible to assign workflow for a view ?
If possible, how?

Workflows are bound to content objects and not views, so no.

-aj

The term "workflow" implies a flow of work steps which operate on something (changeable). In Plone, this something is a "content object". A view in Plone does not change. Thus, you cannot assign a workflow to a view. You can however perform a workflow transition in a view on the viewed content object.

1 Like

You can work around this, to get the (UI) you want. Maybe you can add interfaces during the normal workflow, and then register views to interfaces.
If you explain what you are trying to do (and why), it would be easier.

1 Like

It is a leave request form(a view) . When a user submits, it should go for next level approval (One or two levels.This will be achieved by workflow ).The the form goes to next state it should be editable also.

Completely broken approach.

Wizard-like form or multi-level forms are to be implemented using the underlaying z3c.form framework or on whatever you want to build your forms.

Again: no workflows for views...wrong trail.

-aj

To attach a workflow to something, this something must be persistent (i.e. live across requests, across server shutdowns, etc.). A "View" is an adapter and adapters are temporary objects; they live only in a single request.

The form frameworks use by Plone can give the impression as if a form had an associated workflow. But this is a bit of treachery: it works by using a single large form where each consecutive "stage" displays only a part of this form. This way, the entire form entry can be split across consecutive requests and each handle related fields of the common form. Maybe, you mean this kind of "workflow"?

1 Like

This is easily done with Products.PloneFormGen and uwosh.pfg.d2c. The person fills out the form, to which you added a d2c adapter, which creates an Archetypes-based content item containing all the fields of the form and the values entered by the person. The content item can be assigned a workflow like any other Plone content item. You have to define a workflow that does what you stated, maybe starting by cloning the Simple Publication Workflow.

1 Like

If you prefer not to use Archetypes, you can still do something similar just by creating a Dexterity content type, and when someone wants to fill out a form they in fact just add one of these content items.

1 Like

@erasmu this is from last year but could still be useful to you http://www.slideshare.net/tkimnguyen/easy-online-business-processes-with-plone-forms-and-workflow