Expand my Community achievements bar.

Detect server in Adobe AEM WorkFlow?

Avatar

Level 3

Is it possible to detect on what server the the current WorkBench Process is running in an Adobe AEM Workflow? We want to watermark the documents only if the Workflow is running on non-production server and we want to have the same workflows on both production and non-production servers.

8 Replies

Avatar

Level 8

Just a thought.

Probably in the process args passed to the workflow we can pass the environment details say dev, which will be picked up later in the code to determine the route that its got to take.

Avatar

Level 10

You can do a check on run mode.That can help you

Avatar

Level 5
Level 5

BjornEricsson wrote...

Is it possible to detect on what server the the current Workflow is running in an Adobe AEM Workflow? We want to watermark the documents only if the Workflow is running on non-production server and we want to have the same workflows on both production and non-production servers.

 

 

You can get this done by using the org.apache.sling.settings.SlingSettingsService

Example code snippet that can print the run modes in your JSP shown below, same can be used in your OSGI JAVA logic.

<%@page import="org.apache.sling.settings.SlingSettingsService%> <% pageContext.setAttribute("runModes", sling.getService(SlingSettingsService.class).getRunModes().toString()); %><%= pageContext.getAttribute("runModes") %>

above code snippet prints output in JSP as [samplecontent, author, crx3tar, crx3] where my local instance is running in author mode with samplecontent. which can be found in your instance at /system/console/status-slingsettings.

Avatar

Level 3

I Think that I used the wrong wording in my original post. I want to detect server type in a Workbench Process. Is that doable with this approach?

Avatar

Level 5
Level 5

BjornEricsson wrote...

I Think that I used the wrong wording in my original post. I want to detect server type in a Workbench Process. Is that doable with this approach?

 

There is a difference between the  Workflow and Workbench (Workbench is an integrated development environment (IDE) that developers use to create and manage AEM forms applications and assets.) in AEM terminology, AFAIK "It is not possible to run Workbench processes with AEM Workflows" and looks like your requirement needed to have a custom workflow and a custom process step which can do your functionality.

Avatar

Level 5

BjornEricsson wrote...

I Think that I used the wrong wording in my original post. I want to detect server type in a Workbench Process. Is that doable with this approach?

 

What do you mean by "server type" if not author vs. publisher? or dev/testing environment vs PROD environment?

Both of these scenarios can be covered by checking run modes, you would just need to include a few extra run modes for each environment (integration, staging, production).

Avatar

Level 10

Greg is correct in this response. Run modes is the solution here. 

Avatar

Level 3

Yes, I have read about that elsewhere .How do I write a transition expression, in the Workbench, that detects run mode?