Sitecore 8.2 Update 5
Kind of at a real loss here. Should be really simple code, just can't get the commands. In the code below workflow and workflow2 are not null and is the correct workflow.
In command, I am getting the commands for the current item's FieldIDs.WorkflowState. No commands are returned.
In command2, I am calling the state directly by ID. Still no commands are returned.
var database = Sitecore.Configuration.Factory.GetDatabase("master");
var workflow = database.WorkflowProvider.GetWorkflow(item);
var command = workflow.GetCommands(item[FieldIDs.WorkflowState]);
var workflow2 = database.WorkflowProvider.GetWorkflow("{6AC12F8A-9374-41A3-B2D9-DBC7C9A0FB73}");
var command2 = workflow2.GetCommands("{8B439291-76EE-46D2-ACEE-2BC67142D35F}");
var command = workflow.GetCommands(item[FieldIDs.WorkflowState]).FirstOrDefault();
Do you get a result?IWorkflow workflow = item.Database.WorkflowProvider.GetWorkflow(item); if (workflow == null) return new WorkflowResult(false, "No workflow assigned to item"); WorkflowCommand command = workflow.GetCommands(item[FieldIDs.WorkflowState]) .FirstOrDefault(); if (command == null) return new WorkflowResult(false, "Workflow command not found");
What does that get you?