kenticokentico-api

Workflow API Roles which can approve, reject and make changes Only Listed


Using Kentico 11.0.26. How do I select this option programatically when creating a workflow using Workflow API

enter image description here

EDIT: After running the code sample in link above, the very first radio button "None" gets selected. If you go to Kentico and manually select "Only listed" option, the role added programatically appears.


Solution

  • You can achieve that with the code sample that you already linked in your post. That settings is placed directly on the step itself, so with code like this you should set it:

    // Here Only listed security is assigned to current step.
    step.StepRolesSecurity = WorkflowStepSecurityEnum.OnlyAssigned;
    

    EDIT:

    Additionally save workflow step after update StepRolesSecurity property:

    WorkflowStepInfoProvider.SetWorkflowStepInfo(step);