Clean scheduled workflow memory | Community
Skip to main content
Level 2
June 4, 2020
Solved

Clean scheduled workflow memory

  • June 4, 2020
  • 2 replies
  • 4965 views

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?

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

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

 

2 replies

Jyoti_Yadav
Level 8
June 4, 2020

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.

 

Abraham92Author
Level 2
June 4, 2020

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"

Anita_punmiya
Anita_punmiyaAccepted solution
Level 5
June 5, 2020

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

 

Abraham92Author
Level 2
June 16, 2020
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 ?