Clean scheduled workflow memory

Abraham92

03-06-2020

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?

Accepted Solutions (1)

Accepted Solutions (1)

Anita_p

MVP

04-06-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

 

Answers (1)

Answers (1)

Jyoti_Y

MVP

04-06-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.