How to delete the instances of a sub process upon completion that was started by the Start Process Smart Service node?

Certified Associate Developer

Is there a way to delete all the instances of a sub process upon completion when called from a start process smart service node in a parent process ?

We are facing performance issue of high memory usage in one of the process in our application. The current design is, there is a parent process where the list of not completed tasks are retrieved and a sub process node (configured as MNI) where the notification emails are sent to the task owners. In order to improve the performance we are planning to replace the synchronous sub process with a start process smart service. But the challenge we are facing is how to delete the sub process instances once it is completed?

Since the child process is a common object used across other process in the application, we have the restriction of updating Automatic Process Clean-up 'Delete processes 7days after completion or cancellation' option in the Data Management setting. In other process of the application we need to retain the instance for particular no. of days.

We tried selecting the 'When this node is completed: delete previously completed/canceled instances' in the Other tab of the start process smart service node but it didnt work, please suggest any other available options.

Before: 

 

After: 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Hello  

    Can we make any changes to the Child/sub-process with no changes in the data management. 

    If we can add few more nodes below is an solution:

    1.   Create a new process with Delete processes plugin. Use the process ids as Parameter.   Process Management Services 
    2. Call this model in a start process node of your Sub-process (Generate groups to send email) with a XOR(this will be a Boolean value that will be passed from parent model) to define whether the current instance should be deleted or not.  
    3. Make sure you place a timer in the delete process model to ensure

    If you cannot edit the existing model, use the below

    1. Pass the Parent process id into child process as parentId Process variable
    2. Create a process analytical report for the child process where parentId is not null and for completed instances
    3. add a XOR after the Smart service process in parent process - to check if the count of completed instance = count of process triggered by smart service . if it yes than call delete process smart service (plugin) pass the process id from the report else put a timer of 1 min and roll back to XOR 
Reply
  • 0
    Certified Senior Developer

    Hello  

    Can we make any changes to the Child/sub-process with no changes in the data management. 

    If we can add few more nodes below is an solution:

    1.   Create a new process with Delete processes plugin. Use the process ids as Parameter.   Process Management Services 
    2. Call this model in a start process node of your Sub-process (Generate groups to send email) with a XOR(this will be a Boolean value that will be passed from parent model) to define whether the current instance should be deleted or not.  
    3. Make sure you place a timer in the delete process model to ensure

    If you cannot edit the existing model, use the below

    1. Pass the Parent process id into child process as parentId Process variable
    2. Create a process analytical report for the child process where parentId is not null and for completed instances
    3. add a XOR after the Smart service process in parent process - to check if the count of completed instance = count of process triggered by smart service . if it yes than call delete process smart service (plugin) pass the process id from the report else put a timer of 1 min and roll back to XOR 
Children