In Sitecore is it possible to have a workflow set up such that changing some field of an item does not cause the item to go to approval states?
We would like to have several fields editable and immediately publishable, while enforcing workflow for a change to one specific field. This field if edited would pass the item to the 'Awaiting Approval' state.
I didn't find anything on how to do this in the reference: http://sdn.sitecore.net/upload/sitecore6/sc61keywords/workflowreference-a4.pdf
I have since written some code which came out of Steve's reply and an example on this snippet: http://sdn.sitecore.net/faq/api/cause%20the%20workflow%20to%20invoke%20an%20action.aspx
class Filter
{
public void Process(WorkflowPipelineArgs args)
{
Database master = Factory.GetDatabase("master");
Item item = args.DataItem;
IWorkflow wf = master.WorkflowProvider.GetWorkflow(item);
AllowPublishIfNoChangeToBodyField(item, wf);
}
/// <summary>
/// If the item's 'Body' field was not modified change the workflow state to Pending Publication
/// by running the Approve and Submit for Publication command
/// </summary>
/// <param name="item"></param>
/// <param name="wf"></param>
void AllowPublishIfNoChangeToBodyField(Item item, IWorkflow wf)
{
using (new Sitecore.SecurityModel.SecurityDisabler())
{
if (true//pseudo code for now: body wasn't modified)
{
wf.Execute("{command-id}", item, "allow edits and publishing of all fields other than 'Body'", false);
}
}
}
}
The problem is The 'Next State' of the 'Command' overwrites whatever state change I make to the item in the 'Action'.