Question

Starting subprocess after record is deleted

Hello,

 

I'm having trouble designing a process that is triggered by the deletion of a record. At the moment, the process looks like the screenshot attached. First, I need to read the record that is about to be deleted to find some other ID. Then, I want to start a subprocess that uses this ID. However, this subprocess should only start once the record is actually deleted. How can I accomplish that? At the moment, the subprocess is started before the record is actually deleted and thus isn't working properly.

 

Kind regards

Kai

Like 0

Like

12 comments
Best reply

Kai Wilker,

 

You need to create a process that is connected to the object itself and is connected to the delete event. To do this you need to go to the object settings and click this button:

Once done you will see a process editor where you can create custom script tasks that can process the record. Also the start signal for the process should be catching a message that is generated before or after deleting a record (called CaseDeleting and CaseDeleted in my example above). Please examine base processes from "Case" object in the "Case" package for example so to create your own process.

 

Best regards,

Oscar

Hi Kai, 



You can implement such behavior by using a start signal which has that kind of logic.



Please find the example of a business process which is triggered by record deletion attached.



Thank you.

Bohdan Zdor,

to Kai's point. How can I capture the GUID of the deleted record though? The above process would start once the record is deleted at which point the GUID does not actually exist anymore.

Hi Oliver,



Maybe, this community post will help you on it:



https://community.creatio.com/questions/delete-trigger



Thank you.

Oliver Schmidt,

 

This article outlines how to read the record being deleted in a process: https://customerfx.com/article/working-with-delete-signals-in-a-process…

 

However, keep in mind, if all you need is the ID, you can get that from the signal start.

Ryan

Kai,

If all you need is the ID of the record getting deleted, and not to read the other data of the record getting deleted, then all you need to do is change the start signal to "run in background", then the record will be deleted at that point, and you can get the ID of the record deleted from the start signal. However, you won't be able to read any of the other data of the record deleted since it's gone at that point.

Ryan

Bohdan Zdor,

Thanks for your reply. I'm already using the start signal you described. The problem for me is that I first need to read to record about to be deleted (that is, doing an action before the record is deleted) and afterwards I want to start a subprocess that only works properly after  the record is deleted.

Ryan Farley,

Thanks for your help! I've actually read the the article written by Tate Farley about this, which helped my understanding a lot. Unfortunately I need to more than just the ID of the deleted record, I need to read this record for a last time and find an ID of a connected record. Then however, I want to start a subprocess that should only start once the record is actually deleted. Maybe I could use to onDelete function to that end, as described in the other thread?

Kai Wilker,

 

You need to create a process that is connected to the object itself and is connected to the delete event. To do this you need to go to the object settings and click this button:

Once done you will see a process editor where you can create custom script tasks that can process the record. Also the start signal for the process should be catching a message that is generated before or after deleting a record (called CaseDeleting and CaseDeleted in my example above). Please examine base processes from "Case" object in the "Case" package for example so to create your own process.

 

Best regards,

Oscar

Oscar Dylan,

Thank you for your help! This is exactly what I was looking for.

Ryan Farley,

Thanks Ryan,

 

For me this a headache, so If I uncheck "run in background" for all next purposes the record still exist. I mean if I want to sum all invoice detail records related to the same invoice, I need the get the invoice number, so I need to uncheck "run in background", but later when sum the detail records, the deleted record also is included in the sum, how can I, after get the invoice number, can sum the invoice detail records exluding the deletede one?, I can introduce in the condition "and Id != id of deleted record", but is a more transparent and clear way to do this?

Julio.Falcon_Nodos,

Hi Julio, the only way to do this when you uncheck the "run in background" is to exclude the deleted record Id from the sum (add a filter where the Id != deleted record Id)

Ryan

Ryan Farley,

Thanks Ryan, in this case I will have no info regarding the deleted record, so I'll treat deleted trigger as special case and exclude the deleted record from any calculation on the related table , in this way 

Show all comments