Question

Update previous record

Hi guys, 

i've created a business process in which:

- with Status as New, a record is added with Stage as New, Start date as current date, end date is null

- when this record Status is changed, end date of previous record is updated to Current date.

Ex:

A Request no 44 is created at 8 am, so Stage: New, Start date: 8am, End date: Null

then at 9 am the status is modified into Approval, so, there are 2 records

1. Stage as New, Start date as 8 am, end date as 9 am

2. Stage as Approval, Start date as 9 am, end date as Nulll

Can you guys help me with this? Many thanks

Like 0

Like

1 comments

Hi Trang, 

It's not possible to implement such a logic using no-code tools, however, you can do it by implementing an EntityEventListener and implementing an override for the OnSaving() method. 

Then you can access both the new value of the column(in your example Stage) and the old value. That way you can filter and update the value in your "ObjectInStage" object. 

More information on EntityEventListeners here

Such functionality is already implemented for Lead and Case objects, you could try and use them as an example. 

 

Best regards,

Yurii

Show all comments