Detect server in Adobe AEM WorkFlow?

Avatar

Avatar

BjornEricsson1

Avatar

BjornEricsson1

BjornEricsson1

17-02-2017

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.

Replies

Avatar

Avatar

cquser1

Avatar

cquser1

cquser1

17-02-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.

Avatar

Avatar

edubey

Avatar

edubey

edubey

17-02-2017

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

Avatar

Avatar

Var

Avatar

Var

Var

17-02-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.

Avatar

Avatar

BjornEricsson1

Avatar

BjornEricsson1

BjornEricsson1

17-02-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?

Avatar

Avatar

Var

Avatar

Var

Var

17-02-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.

Avatar

Avatar

Gdubz-57m2mu

Avatar

Gdubz-57m2mu

Gdubz-57m2mu

17-02-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?

 

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

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

17-02-2017

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

Avatar

Avatar

BjornEricsson1

Avatar

BjornEricsson1

BjornEricsson1

19-02-2017

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