Jay
Jay

Reputation: 1201

Sitecore How to Know If Workflow process is done (Approved state and published)

I'd like to know if Workflow process is done or not.

What I wanted to do is: I created an assembly and once Workflow process is in Final state or Auto-Publish work is done, execute the method in the assembly.

<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
    <sitecore>
        <events>
            <!-- Once Workflow autoPublish is done, do this for CDN -->
            <event name="publish:complete:remote">
                <handler type="My.Class.Name, Assembly.Name" method="MethodName">
                </handler>
            </event>
        </events>
    </sitecore>
</configuration>

How can I do this??

Upvotes: 0

Views: 433

Answers (2)

Dražen Janjiček
Dražen Janjiček

Reputation: 409

It depends on what you really want. Do you want to know that the particular item has passed the workflow or do you also want to know that the async publish action has completed? Defining an additional action after the auto publish is definitely the easiest way. Adding an event handler is also possible but more complex since the event handler will be triggered for each item / site publish. How are you going to differentiate?

I see you're using the publish:complete:remote event but I wonder if Sitecore even uses it. HtmlCacheClearing for example is running in the publish:end:remote event.

Upvotes: 0

Anton
Anton

Reputation: 9961

All action that you have under workflow command work in a similar way as regular pipelines and processors that you have in your configuration files. But in this case command is pipeline and action is processor.

So, to execute something just after Auto-Publish command you should add another one command after Auto-Publish command. This new command should contain link to method that you to execute.

Upvotes: 3

Related Questions