Power Automate Delete Trigger - Missing record values
If you are using Power Automate Flow with MS Dataverse Delete trigger and trying to find a way to retrieve attributes value from a deleted record, you are in the right place!
ISSUE DESCRIPTION
MS Dataverse Delete trigger is triggered post action. That means that record values are already missing from the database when trigger is triggered. Therefore, if you want to reuse some value that was part of that record, you will not be able to.
HOW TO DO IT
REQUIREMENTS
- Audit needs to be enabled globally in environment
- Audit need to be enabled on entity you are targeting
IMPLEMENTATION
- You need to get last Audit record related to deleted record.
- OData example:
/audits?$filter=_objectid_value eq ''&$orderby=createdon desc&$top=1
- OData example:
- This call will return Audit record with
changedata
attribute changedata
value is stringified JSON object which will containchangedAttributes
array- Parse this JSON object and you’ll get last existed values in
oldValue
object key value ofchangedAttributes
array
Hope this helps.
To submit comments, go to GitHub Discussions.