Dear all,
I have a custom entity of which I want to track when each record was being deactivated.
What would be the best way to do this? Probably an Power Automate flow, but I don't really see what steps it should consist of...
thanks,
Koen
A little update: I ended up adding a "CloseDate" field, which is set by the end-user; A flow will then check every day for all records with a CloseDate and deactivates it...
Hi @KoenJanssensPD,
Yes,, if it needs to automatically close (deactivate) a record in the future, the simplest would be a close date filed with a schedule Power Automate flow that run daily which deactivates the records. Check that the record is not already closed and doesn't have a date before setting the date though. I would try to keep it as simple as possible, but a user can also deactivate so as I mentioned in my 1st post, have either a sync or another flow to set the close date if the record was closed by a user.
Hope this clarifies....
so maybe I'm oversimplifying things, but since a deactivated record is inactive and cannot be modified, can you just get a list of inactive records with modified on date? That should tell you when records were deactivated.
Yes, I know that if you really want to you can update inactive records (I wrote tip of the day 254 after all) but this almost never happens. sometimes the simple solution is the best.
Thanks everybody for your thoughts!
To explain a bit the business case: records are created when needed, and deactivated when not needed anymore (and will not be needed in the future) except for BI purposes. We need to know when and how many records where active in the past .
Should I better add a "close" date on the entity? And a flow that automatically deactivates the record when a record is closed?
Thanks,
Koen
To supplement on the previous and my post, there are different schools of thought, but I suggest not to rely on the Modified On date, the record can be updated after it's deactivated (i.e. integration or background jobs) which will auto-update the Modified On date.
I assume the deactivate action happens by the user so a record can be reactivated after it's deactivated, so you might want to clear the deactivated date afterwards. And if a record cannot be reactivated then you can hide the Reactivate ribbon/command bar button with the Ribbon Workbench.
You also can enable audit history on that entity and field, which can remove the need of a custom entity and simplify your solution.
Cheers
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:
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
Hi @KoenJanssensPD,
yes a Power Automate flow would be the preferred approach however it will run asynchronously so users won’t see the deactivated date right away. Make sure you create the flow within a solution and use the “Common Data Service (current environment)” connector: https://docs.microsoft.com/en-us/power-automate/connection-cds-native
The trigger is update of the entity and you can filter only when the statecode field is updated and when the value of statecode = 0
The other way if you need a synchronous process is with classic workflows: https://docs.microsoft.com/en-us/power-automate/workflow-processes
hope this helps