Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

WCMMode in Workflow scripts? Determine Author/Publisher in Workflow steps

Avatar

Level 2

I have a requirement where I need to check the mode (author/publisher) in the workflow step.

There is different workflow for both of these wcm modes. 

I was trying to write function check() using the api WCMMode.

I know there is a way to do it in the components/jsp however the same seems to be not working in the workflows:

Is there anything like the below in workflows (this is to be inside function check)?

var WCMMode = sling.getService(Packages.com.day.cq.wcm.api.WCMMode);

 

If you have any other suggestions/solutions, please do advise. 

 

Thanks!!

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hey Sharad,

If you want to control whole work flow whether it has to run or not you can control it in the launcher configuration in which mode it has to trigger.

If you want to controll only particular step inside the workflow then you can used some code which will tell in which mode that workflow is running. Use run modes concepts for identifying in which mode instance is running,

 Search  with "how to check run modes in adobe day cq" you will get lot of results for setting run modes or simply accessing and identifying in which mode cq instance is running.

View solution in original post

3 Replies

Avatar

Correct answer by
Former Community Member

Hey Sharad,

If you want to control whole work flow whether it has to run or not you can control it in the launcher configuration in which mode it has to trigger.

If you want to controll only particular step inside the workflow then you can used some code which will tell in which mode that workflow is running. Use run modes concepts for identifying in which mode instance is running,

 Search  with "how to check run modes in adobe day cq" you will get lot of results for setting run modes or simply accessing and identifying in which mode cq instance is running.

Avatar

Level 2

maruthid wrote...

Hey Sharad,

If you want to control whole work flow whether it has to run or not you can control it in the launcher configuration in which mode it has to trigger.

If you want to controll only particular step inside the workflow then you can used some code which will tell in which mode that workflow is running. Use run modes concepts for identifying in which mode instance is running,

 Search  with "how to check run modes in adobe day cq" you will get lot of results for setting run modes or simply accessing and identifying in which mode cq instance is running.

 

 

Hey thanks Maruthi. 

I am using the OOTB workflow moderation in which there is a requirement to identify from which environment the workflow has been triggered. It is getting difficult to identify so I was using a OR split inside the OOTB workflow and in that trying to write the logic for function check. This is an ecma script and getting WCMMode (or any thing related to the check on modes) is freaking me out. Is there a way to identify the mode in the function check or any other way?

I cant change the launcher that is the limitation. 

Thanks,

Sharad

Avatar

Employee

I think you are looking for the SlingSettingService. See this thread: http://forums.adobe.com/thread/1020051

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----