Returning Observer

Set workflow permissions for groups on root or folder via api

Hi all,

I'm trying to set the worfklow permissions for certain groups via api.

The problem I have is that if the check for workflow allowed is not set, the groups I am setting via api is not saved.


If this check is marked, my code for setting the permissions works without problems.

Is there some way to set this check via api? Because so far I haven't been able to find it.

Code so far, try/catch omitted.

Workflow workflow = templateStoreRoot.getWorkflowByName(workflowConfig.getName());
WorkflowPermission workflowPermission = store.getCreateWorkflowPermission(workflow);
for (Group group : groups) {

   for(WorkflowConfiguration.Group configuredGroups : workflowConfig.getGroups()) {

   if (group.getName().equals(configuredGroups.getName())) {




store.setWorkflowPermission(workflowPermission);, false);

6 Replies
Elite Observer

Hello E-spirit,

I have exactly the same behavior like ncbruckner​.

At the point of all information are lost and store.getWorkflowPermissions() returns an empty list.

Is there a solution?

Best regards


0 Kudos

Hi Matthias,

I didn't find one. In the end I went through all the projects and set the check marks and afterwards ran my script. That still saved me some time when going through 30 something projects but it's only a workaround and not a particularly satisfying one either.

Best regards,


0 Kudos

Hi Nina-Christine,

thanks for that - not good - information.

I have to go through ~90 projects.

As long as the API does not work as expected i think I have to do it manually too. 😕

Best regards,


0 Kudos
Crownpeak employee

Hi all,

this behavior is probably a bug. It seems that the workflow permissions can only be set if the corresponding permission object already exists.

Contact our TechSupport if you would like to be actively informed when this has been resolved or check the future FirstSpirit release notes for the ID "CORE-12618".

Best regards,


0 Kudos

Hello Holger,

i already opend a bug report in TechSupport

Thank you for the Ticket ID.

Best regards,


0 Kudos

Hello everyone,

the TechSupport answered.

You need to add the following line:


It seems that you need to break the Inheritance.

The following script sets a permission on a folder.

Full example:


userService = context.getUserService();

pageStoreFolder = context.getElement();

pageStoreFolder.setLock(true, false);

workflow = userService.getStore(Store.Type.TEMPLATESTORE, true, false).getWorkflowByName("release");

wfpermission = pageStoreFolder.getCreateWorkflowPermission(workflow);

group = context.project.getGroups().get(0);



pageStoreFolder.setInheritWorkflowPermission(false);"Saved Workflow rights", false);

pageStoreFolder.setLock(false, false);

Best regards


0 Kudos