Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Need to get the last subjected date for the workflow using AEM querybuilder

samsundar23
Level 4
Level 4

I'm using AEM 6.5.
I want to get the start date as a result when was the last time the particular workflow is subjected using aem query builder.

I tried multiple queries which was not giving the result needed for me. I mean the last time the workflow is used.

I tired below query which was not giving me the expected result;

path=/var/workflow/instances/server0
type=cq:Workflow
1_property=status
1_property.value=COMPLETED
2_property=modelId
2_property.value=/var/workflow/models/test_author/netbank/publish-topcat-content
p.limit=-1

 

Kindly do pour in your thoughts so that I do get my desired result as outcome.

Thanks in advance !

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution
Arun_Patidar
Correct answer by
Community Advisor
Community Advisor

Hi,

Your query looks fine. I am getting the results as expected. PFA.

 

{"success":true,"results":1,"total":1,"more":false,"offset":0,"hits":[{"jcr:path":"/var/workflow/instances/server0/2020-12-09/request_for_activation_1","startTime":"Wed Dec 09 2020 19:35:28 GMT+0100"}]}

 

Screenshot 2020-12-09 at 7.40.47 PM.png

View solution in original post

0 Replies
Arun_Patidar
Correct answer by
Community Advisor
Community Advisor

Hi,

Your query looks fine. I am getting the results as expected. PFA.

 

{"success":true,"results":1,"total":1,"more":false,"offset":0,"hits":[{"jcr:path":"/var/workflow/instances/server0/2020-12-09/request_for_activation_1","startTime":"Wed Dec 09 2020 19:35:28 GMT+0100"}]}

 

Screenshot 2020-12-09 at 7.40.47 PM.png

View solution in original post

samsundar23
Level 4
Level 4

Hi @Arun_Patidar ,

 

Thanks for your inputs.

I want to get start date as a result for the query executed.

For instance, if page-name-change is the custom workflow for which I want to get last time this workflow is subjected in AEM author instance.
Kindly let me know the way.

 

Thanks

SHYAMSUNDAR TK

 

 

Arun_Patidar
Community Advisor
Community Advisor

You will not get the start date alone, you will get workflowInstance node and that you can adapt to node/workflow Api to get start date of last workflow used.

 

path=/var/workflow/instances/server0
type=cq:Workflow
1_property=status
1_property.value=COMPLETED
2_property=modelId
2_property.value=/var/workflow/models/mywf
orderby=@startTime
orderby.sort=desc
p.limit=1

samsundar23
Level 4
Level 4

Thanks bro @Arun_Patidar 

Based on your input I could get the workflowInstance node path which was last subjected.

 

You suggested to adapt to a node/workflow API to get start date of last workflow used.

Does it mean should I be writing a dedicated java class for this query to be executed and then adapt the final output node to a node API and then get the start time as a result ?

Is there any other possibility to get the start date as the direct output in querybuilder ?
Do correct me if I'm wrong.

 

Arun_Patidar
Community Advisor
Community Advisor
you can get results from json output, click on 'JSON QueryBuilder Link' in the querybuilder debugger and call that json from UI if want to show in UI or just hit directly on browser to see startdate
Vijayalakshmi_S
Community Advisor
Community Advisor

Hi @samsundar23,

Cross check the workflow related entries are available in the path we are querying for(/var/workflow/instances/..) in CRXDE at first place. 

If yes, then cross check if you have permissions for the path or can quickly cross verify by executing the query by being in admin login.