Workflow Item follows ERP Formula.
Editor creates item. Reviewer Approves item or Reject item.
If Item is rejected by reviewer then it will go back to Editor. If reviewer
approves item it will then be in Approve and Publish state and can be approved
and published by Publisher.
Before assigning the initial state to this workflow, we
first have to create the state.
It’s up to the requirement whether you have to create two
levels or three of workflow. Here we will look at three levels of workflow
where in as sitecore item reaches its final state i.e. Done then it will Auto Publish to Web Database.
Now let’s set the Initial State as a Draft.
Note: You can give any valid name to commands. Commands will appear to
user. For example here
publisher will have access to Approve and Publish State
where we have provided Approve and Reject
options, instead you can provide Approve and Publish or Reject.
Now let's set the transition
from one state to another with the help of commands.
Click on Submit Command in Draft State and set the Next State to Awaiting Approval State.
Similarly select Approve in Awaiting Approval and set the
Next State to Approve and Publish.
Select
Reject in Awaiting Approval State and set the Next State to Draft.
Similarly from Approve and Publish state Approve Command
will point the Next state as Done and
Reject Command will point the Next State
to Awaiting Approval State.
Note: Suppress
Comment: This checkbox defines whether or not users are prompted to enter a comment when a workflow command is executed. If the checkbox is cleared, users
are prompted. If the checkbox is selected, users are not prompted.
4) Creating Workflow Actions
a. Validation Actions
Select Approve
Workflow Command, Right click and select Insert
from Template Command and create the new workflow action using
/System/Workflow/Validation Action template. Call the new command “Validation Action”.
You will get the below screen. Enter the
following information in Fields.
Type Field: Sitecore.Workflows.Simple.ValidatorsAction,Sitecore.Kernel.
Max Result Allowed: Warning
The maximum response from the validator.
The possible values are:
Unknown
Valid
Suggestion
Warning
Error
CriticalError
FatalError
If the value of this field is “Error”, then
items which have errors will pass, but the items which have critical errors
will not pass.
Fill the error results with proper error messages that you want a user to see in case of validation errors.
Similarly add Validation Action at Approve in Approve and Publish State.
b. Auto Publish Action
The data section of this workflow action
contains the following fields:
Type:
The namespace.class, assembly name of the implementation class.
For
Example: Sitecore.Workflows.Simple.PublishAction, Sitecore.Kernel
Parameters:
The deep parameter that specifies whether or not the child items should be
published.
deep=1
--- publish children
deep=0
--- do not publish children
related=1
--- publish children (Sitecore 7.2 onwards)
5) Defining Workflow Final State
Select the state which is
supposed to be the final state in workflow and select the Final Checkbox
in the Data field:
Only those items which are
approved by publisher in Approve and Publish state will move on to Done State
of workflow and it will be published automatically.
6) Assigning workflow to a Template
It
is always the best practice to assign the workflow to the standard values item
of a template.
Select
the Standard Fields Checkbox.
Leave the Workflow and the State field’s blank, as they will
be filled automatically upon the item creation basing on the workflow settings.
Leave the Lock field as it is.
Save the template and now it is ready to use with workflow
support. First phase of creating a workflow is complete.
Now let’s see how to use workflow for
creating-reviewing-publishing items in
Part-2