Expand my Community achievements bar.

SOLVED

Clean scheduled workflow memory

Avatar

Level 2

Hi all,

 

I have a scheduled workflow and sometimes it doesnt give the proper results like I feel it gets stuck with the previous results. For example my workflow has an intersection activity and the intersaction is very simple using email as a key to find the entries and it returns 0 when the 2 inputs are having the same email, or some other times I have a fork which doesnt send the proper results to the 2 outputs so If I stop the workflow and I run it manually it works perfectly fine. At this point I feel like I have to clean the memory after the workflow is completed when it is scheduled so that the next will have empty memory and it will not throw any bad results. Any sugestions to this issue?

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi Abraham,

 

You can write a JS to purge the workflow logs using the workflow id and then start it. 

Follow the below sequence :

  • stop the workflow
  • purge the workflow logs
  • start the workflow

There are predefined js functions to do all the above 3 activities in just one code and you can automate this so it does not require manual effort for clearing the logs.

Frequency you can set once per fortnightly/monthly. 

Multiple recurring workflows on the platform often makes the workflow in a deadlock state with loads of logs.

 

Hope this solution helps.

 

Regards,

Anita

 

View solution in original post

7 Replies

Avatar

Level 9

Hi,

 

Workflow does not store anything once it has finished execution.

It could be possible, your workflow has not finished it's execution before next execution.

Do you have a test activity to check workflow status before proceeding to execution of workflow.

If not, you can follow below steps to avoid workflow running if earlier run has not finished.

1) Define an option - 'isWorkflowRunning'.

2) In workflow, first check value of this option. If it's zero then proceed to execution of workflow activities. If not, then end your execution.

3) After test activity, have a JS, where you will set the value of this option variable as '1', indicating workflow is running.

4) At end of workflow execution, in your end activity, reset option variable value to '0'.

 

Thanks.

 

Avatar

Level 2

Hi, Do I have to check if the workflow gets completed even if it is always on "started" mode? , because my workflow is scheduled and it runs every hour, so everytime I am monitoring it the status is "started"

Avatar

Level 9
Scheduled workflow will always be in Started status if execution is not getting in error. It will not show you Finished status. You can verify from workflow log whether workflow execution has finished or not. Yes, you have to check workflow running status.

Avatar

Correct answer by
Level 7

Hi Abraham,

 

You can write a JS to purge the workflow logs using the workflow id and then start it. 

Follow the below sequence :

  • stop the workflow
  • purge the workflow logs
  • start the workflow

There are predefined js functions to do all the above 3 activities in just one code and you can automate this so it does not require manual effort for clearing the logs.

Frequency you can set once per fortnightly/monthly. 

Multiple recurring workflows on the platform often makes the workflow in a deadlock state with loads of logs.

 

Hope this solution helps.

 

Regards,

Anita

 

Avatar

Level 2
Thanks Anita, I did what you mentioned and seems it is working fine. I will keep monitoring. Thanks

Avatar

Level 2
Hi Anita, after sometime the activites are not working as expected again. They work only when I stop the workflow and run it again manually. I am thinking to split the workflow because it is too big, but first I would like to try to purge the logs using JS everytime the workflow completes the process, do you think it could work ?

Avatar

Level 7

Hi Abraham,

 

How frequent your automated wf runs and also if it involves multiple activities try stopping->purging->start after every run so that it does not end up in a deadlock state or you can start over creating a copy of this workflow.