Comala workflow trigger to set page restriction not working when using a linked workflow
Asked by David Pressley:

I have a few workflows which are applied by setting a space category, and further applied by page label.

In order to link the workflow to a space, I use the 'link workflow' function in the Global Workflow template area. The workflow is applied, however, I also need to set a page restriction once the workflow is applied to limit access to another plugin on the page for a certain user group. This page restriction isn't being set once the workflow is linked, so I must manually go to the document management section of the space tools in order to initialize the first state and set the page restriction. Is this the intended behavior, or do I have my workflow configured incorrectly?

I would be surprised if this is the intended behavior since it takes roughly as much manual intervention as simply setting up the workflow manually from the page menu. in either case I'm clicking space tools, document management, initialize states vs clicking on the page menu and applying the workflow. Granted this isn't a 1:1 example, since i have many pages with the same workflow, so at scale the manual intervention is less, but the requirement to remember to execute a manual step might arguably be the purpose for creating the linked workflow functionality

Just curious to know if this is the intended functionality, or if I'm missing something in the configuration

{trigger:statechanged\|state=Draft\|initial=true}  
{add-restriction:type=edit\|group=admins}  
{trigger}

version 6.13.2


Answers:
author: James Conway
body: Hello [@David Pressley](/t5/user/viewprofilepage/user-id/4171692),

Welcome to the community. Your workflow trigger is fine, the behaviour you describe is expected. The statechanged event only occurs when a state is entered into, in the case of the initial state this is when a page is created. The statechanged event will not occur when a workflow is applied to an existing page. For more details see our documentation about ['unprocessed' pages](https://wiki.comalatech.com/display/CDML/Initialize+States#InitializeStates-Whatare%22unprocessed%22pages?).

If this is something that you expect to do often, could you reach out to our support team at <https://support.comalatech.com> with details of your use case and current workflow markup.

All the best

James  
Senior Product Manager

comments: author: David Pressley
body: Hi James,

Thanks for the response

Does a Comala Publishing Copy to a space count as a page creation? If so, does it follow that I should set my target space up first, set a space category, link the space from the global template before executing the Copy to a space from Comala publishing?


author: James Conway
body: Hi [@David Pressley](/t5/user/viewprofilepage/user-id/4171692)

A Comala Publishing space copy in to a clean space counts as a page creation. The simplest workflow to set restrictions on page creation looks like:

```
{workflow:name=Restrictions}
    {state:Test}
    {state}
    {trigger:pagecreated}
        {set-restrictions:type=view|user=james}
    {trigger}
{workflow}
```

For full details of the set restrictions macro, see [https://wiki.comalatech.com/display/CDML/set-restrictions+macro](https://wiki.comalatech.com/display/CDML/set-restrictions+macro?)

One thing to take care of before making your space copy with Comala Publishing, please ensure that you untick the '**Copy page restrictions**' advanced option.

Kind regards

James  
Senior Product Manager


Tags: comala

confluence-server

server