Re: Save date of deactivation in custom CDS entity
One issue to consider is that, once a record is inactive, you can't update it, so you can't simply add a field to the custom entity for the deactivation date, and set it via an asynchronous workflow (either Power Automate, or classic and asynchronous). There are 3 options, in my order of preference:
- Use a synchronous (classic) workflow that runs on the Before stage, which updates the field on the custom entity
- You could just use the modifiedon field. Once a record is inactive, it can't be changed, so the modifiedon is necessarily the date of the last change, which was the deactivation
- Store the deactivation date in a child entity of the custom entity, then use any workflow type to create this. An advantage of this is you'd have a history of every time the record is deactivated, if this is useful
For completeness, you could have an asynchronous workflow that reactivates the record to set the field, then deactivates it again, but you'd also have to avoid getting in a loop