Detect server in Adobe AEM WorkFlow? | Community
Skip to main content
BjornEricsson1
Level 3
February 17, 2017

Detect server in Adobe AEM WorkFlow?

  • February 17, 2017
  • 3 replies
  • 4953 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

cquser1
Level 7
February 17, 2017

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.

edubey
Level 10
February 17, 2017

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

Var
Level 4
February 17, 2017

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.

BjornEricsson1
Level 3
February 17, 2017

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?

Var
Level 4
February 17, 2017

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.