Scenario:
Auto submit/Skip workflow states to specific language itemsSolution:
Add "Auto Submit Lang Items Action" of type "Auto Submit Action"inside the __OnSave command.Then, I have choosen to skip/auto submit "en" language items directly into "Approved" state.
Code :
public class AutoSubmitLangItemsAction
{
public void Process(WorkflowPipelineArgs args)
{
Assert.ArgumentNotNull(args, "args");
ProcessorItem processorItem = args.ProcessorItem;
if (processorItem == null || args.DataItem == null)
{
return;
}
Item innerItem = processorItem.InnerItem;
string langName = innerItem["role name"];
if (!langName.Equals(args.DataItem.Language.Name, StringComparison.CurrentCultureIgnoreCase))
{
return;
}
ID iD = MainUtil.GetID(innerItem["next state"], null);
if (iD.IsNull)
{
return;
}
args.NextStateId = iD;
}
}
Possible Improvements :
I have used the "Role Name" field to specify the language. But, one can create a custom template with "Auto Submit Language" field of type "TreelistEx" with DataSource pointing to language items
Update : I have make this into a Sitecore Marketplace Module.
No comments:
Post a Comment