Working with approval tasks in Dataverse
Table of contents:
This post is inspired by some recent talks I have delivered. I will describe you deeply how approval tasks are organized in Microsoft Dataverse and what can we do with them.
The basics
Power Automate and Microsoft Teams approval tasks are stored in Microsoft Dataverse. The database related to the environment, where a task is created.
Good to know! Tasks are always stored within the Microsoft Dataverse in the environment, where they are created. Therefore there is no “one-place-to-rule-them-all” available as of today.
- Flow approval – stores basic information about each approval like when it was created and by whom. Also, in case it was created by an action that as well waits for an approval, it stores Flow Notification URI, which is used then to complete waiting on the action,
- User – in Dataverse all users’ objects are stored inside this table, it is synced with a list of users who has access to the environment which is synced with Azure AD,
- Approval – header table of all approvals. It stores approval name, requester, details of approval,
- Approval request – stores info about each single task generated for the approval (the more assignees, the more tasks),
- Approval response – stores info about each completed task, like the outcome.
So now we know the basics. Anytime a task is created in either Power Automate or Microsoft Teams, process creates entries in Flow approval, Approval and Approval request tables. Let me now tell you what actually is being created per each scenario.
Task created
With each new task data is created in 3 tables:
- Approval
- Approval – autogenerated ID
- Allow Reassign – boolean
- Approval Model Id and Approval Stage – has the same value as Approval
- Created By – who created the approval
- Created On – timestamp
- Details – markdown contents of the task description
- Modified By – by default the same user who created
- Modified On – by default the same date as Created On
- Owner – again, user who created
- Send Email Notifications – boolean
- Stage – Basic
- Status – Active
- Status Reason – Pending
- Title – title of the task
- Flow approval
- Flow Approval – the same identifier as generated for Approval, inside Approval table
- Created By – it will be Microsoft Flow
- Created On – timestamp
- Flow Id – it seems to be flow id, but used internally
- Flow Name – guid of the flow where the task was created
- Flow Notification URI – URL that once called (POST) completes waiting action
- Flow Run Sequence Id – that is ID of the instance, that where the task was created
- Modified By – as Created By
- Modified On – as Created On
- Owner – who created task
- Send Flow Email Notification – boolean
- Send Flow Push Notification – boolean
- Status – Active
- Status Reason – Created or WaitingForApproval (if action waits)
- Approval Request
- Approval Request – autogenerated id
- Allow Reassignment – boolean
- Approval Id Index – identifier of the Approval, generated in Approval table
- Approval Stage – as above
- Created By – who created task
- Created On – timestamp
- Last Notified On – if notification about task assignment was sent – when
- Modified By – by default the same as Created By
- Modified On – by default the same as Created On
- Owner – who created task
- Response options – list with possible outcomes
- Stage – Basic
- Stage Index – Basic
- Status – Active
- Status Reason – Active
Lots of fields to be set, but most of them is updated automatically based on the connection that is used to create records in Dataverse.
Tip! In Flow Approval table, for approvals generated with actions that wait for approval, you can find links inside Flow Notification URI column. This URL can be used to submit a POST request, that simply completes the waiting action. It is built from the following pieces:
https://[instance].westeurope.logic.azure.com/workflows/[Flow Id]/runs/[Flow Run Sequence Id]/actions/[Action name that waits for approval]/run?api-version=2016-06-01&sp=%2Fruns%2F[Flow Run Sequence Id]%2Factions%2F[Action name that waits for approval]%2Frun%2C%2Fruns%2F[Flow Run Sequence Id]%2Factions%2F[Action name that waits for approval]%2Fread&sv=1.0&sig=[some signature key]
Moreover, along with the POST, you can submit a body contents of your choice, so simply pass all the information you need after waiting is completed (like outcome, comments etc…).
Task completed
- Approval
- Completed On – timestamp
- Modified On – timestamp
- Modified By – who completed the task
- Result – string, the outcome
- Stage – Complete
- Status – Inactive
- Status Reason – Completed
- Flow Approval
- No changes, if no action waits for approval, if yes:
- Status – Inactive
- Status Reason – Completed
- Approval Request
- No changes
- Approval Response
- Approval Response – autogenerated identifier
- Approval Id Index – Approval identifier generated in Approval table
- Approval Stage – as above
- Comments – any comments written along with approval
- Created By – Microsoft Flow
- Created On – timestamp
- Modified By – Microsoft Flow
- Modified On – timestamp
- Owner – who completed task
- Response – outcome
- Stage – Basic
- Stage Index – Basic
- Status – Inactive
- Status Reason – Committed
Task reassigned
In this scenario, the only change that takes place is present inside Approval Request table:
- Original task
- Status – Inactive
- Status Reason – Reassigned
- New created entry
- All data the same as when a new task is created plus
- Reassigned From – identifier of the original Approval Request entry
Important! When Reassigning tasks, be sure to follow the principles:
1. Users can’t reassign tasks not assigned to themselves,
2. Users can’t reassign to the themselves,
3. Users can’t reassign to task’s creator.
Task canceled
- Approval
- Result – Canceled
- Stage – Complete
- Status – Inactive
- Status Reason – Canceled
- Flow Approval
- No changes, if no action waits for approval, if yes:
- Status – Inactive
- Status Reason – Completed
And that’s it. I hope you will find it really useful when working with tasks outside of the basic UI in Power Automate or Microsoft Teams.
Joseph
Dear Tomasz and many thanks for sharing your knowledge. However, i found it difficult to implement this. Could share a practical scenario so i apply as directed. thanks
Tomasz Poszytek
Please navigate to my YouTube channel: https://youtube.com/TomaszPoszytek – you can find there practical scenarios 🙂
Denny OY
Hi Tomasz ,
I’m working on a approval flow where I need to update the approval action outside the approval flow (using Powerapps ). After watching your videos on YouTube, I can honestly say that you created a work of art.
I’m new to this field, so could you be able to share me a full account of each step made in that flow.
Tomasz Poszytek
Thank you. Speaking about sharing – I believe steps described and shown in videos are enough to make it possible to re-create them.
Natalia
Hi Tomasz, great work here.
I’m trying to make this solution work. I want to quit the approval by updating the tables and I succeed BUT: in teams status remains as Requested (in all 4 tables, in power automate approvals and in na email notofication status is changed to Approved, only in teams it remains as requested but it is final status so user cannot do anything else there).
With POST I have a problem that I don’t know how can I get the signature key. By checking the approval table i’ve noticed that this field is filled with unique key for each entry.
Tomasz Poszytek
Hey, thank you! Basically once you do updates in all required tables (especially inside Approval table) the status in Teams is changed as well. Jsyk – tested a moment ago. With the POST request – where do you need the signature key? Flow Notification URI is complete – you should just use it to make a POST request.
Sagar
Hi Tomasz,
I am creating a Power app through which I need to approve or reject approval flow by just clicking approve or reject button in Power app. Is there any way to do this.
Tomasz Poszytek
Yes, simply follow the steps I described – you need to update specific tables and in the end send POST request to FlowNotificationURI.
Zach Bean
This is great! Is there a way to grab requestor, basically sent on behalf of details. Seems those are null but we are using it a lot since we dont want each approval to look like its coming from the service account only.
Tomasz Poszytek
When you fill in the “Requestor” column, then this person is saved as the “Owner” of the record inside “Approval” table. If Requestor is not filled, then it the account that executes action will be used – I think this is what you’re looking for.
Iain Ray
Hi Tomasz, thanks for the breakdown above, been looking for when an approval is created where to find the Approvers, i can’t seem to find them when an approval has been created and pending, only after a response has been added to the table. An ideas?
But i want to build a list of what people have to approve in Sharepoint for a counter on our intranet, rather than having to look in Teams Approvals.
Thanks
Tomasz Poszytek
Hey, all approvers can be found inside Approval Request table. There are entries generated per each task in the process.
Sharon
Hi Tomasz, In the Approval Response table Owning User is Blank. I cant find any of my Approvers anywhere in the table. Am I supposed to add the “Owner” column somehow?
Tomasz Poszytek
You should have data in “Owner” and “Owning User Index” columns. These two columns store information about user who completed task.
Sharon
I do not have “owner” I only have “owning User” and of all the columns – that one is blank! The Response column is populated and its shows Approve, Reject & Pending But the Owner is blank! It’s so odd & Frustrating. The information you provided on this webpage is fantastic and very helpful. Thank you. I just wish that one column would populate! Without the former “task” list I need to find a way to track the approval status.
Tomasz Poszytek
Thanks for your kind words. I was thinking, that maybe you don’t have a correct security role assigned, that maybe columns Owner and Owning User Index have column security enabled, but that’s not a thing in my case. My account has “System administrator” security role assigned. What role has your account?
Sharon
I agree with you! I have not been able to figure out what my assigned security role is. My hunch is that I and NOT set to system administrator!
Marko Obradovic
Hi Tomasz, thanks for a great and helpful article. I tried to recreate the same scenario, and only thing I couldn’t achieve is to generate HTTP URI. Columns that I couldn’t find in dataverse were: instance, Action name that waits for approval, Some signature key. Any assistance from your side is extremely beneficial. Thanks in advance
Tomasz Poszytek
You should check what environment roles does your account have. It should have “Approvals Admin” as far I know, so that you will have access to all the columns.
Daniel Westerdale
Hi Tomasz. is the row data held in these tables purged after 30 days, as I have been given a requirement to run BI reports over the related approval tables ? I guess the alternative is to define our own db schema to replicate the approval tables, but only for certain approvals in our environment.
Tomasz Poszytek
From what I know Approval tables are not having any retention policies, so data is stored there forever.
Daniel Westerdale
Thanks for confirming.
Karthik
Hi, Tomasz. Thanks for the wonderful writeup, the task completion worked like a charm! I’m now working on the re-assign function, and have managed to add a new record with the target owner to the approval request table. However, this doesn’t show up on the Approvals page of the target owner. Any thoughts?
My account has sys admin and approval admin rights. And, as I understand, re-assigning the task this way doesn’t trigger a notification to the user, or is there a way to it?
Tomasz Poszytek
The reassignment trigger notification although it is sent with some random delay. Also, please check if the new assignee has the “Approval user” security role assigned.
Sarah Cool
Hi Tomasz, I tried to reassign approval tasks with dataverse and power automate. When I check my sent approvals, I can see the reassignment, but the person who is supposed to get the reassignment task, is not seeing the approval in the teams app, nor in the power automate approvals. He did get an email notification after one day.
Can you please help me what I could be doing wrong?
Tomasz Poszytek
Can you check and confirm the user has Approval User env. security role assigned?
Aylin
Hi Tomasz, i have the same problem like Sarah and i checked that the user has Approval User env. security role assigned.
Tomasz Poszytek
Is it a custom environment or the default one?
Aylin
it is a custom environment
Tomasz Poszytek
Could you grant them the “Basic User” env. role and if that doesn’t help – system customizer and check then?
Aylin
Hi Thomasz,
the problem is that the reassigned user has access to the item in the Approval Request list, but no access to the main item in the Approval list. So the main item is not shared with the user.
How can i assign the user the “Record was shared with me” permissions.
Tomasz Poszytek
oh, that’s the good point. Didn’t know about it! Well, you can use the actions from Dataverse “unbound action” and then select grand access.
Gabriel Oxobi
Hi Tomasz, I´m trying to develop a flow that gets triggered when a new row is added to Approval Requests table. It works fine when I create the approval, but it does not triggers when I reassign the approval to another person. I´m trying to obtain the data when person A reassigns the approval to B, I want to get the name and email of this last one to update the info in a Sharepoint list but I´m not able to do it. In every test I do, the result is my name and email.
Tomasz Poszytek
Because the reassignment doesn’t affect the Approval table. It is purely happening in Approval Request table.
Eric Mases
Nice overview, thanks a lot!
I am looking for a way to trigger the Follow up function which is available to Sender from the Approvals app.
Doesn´t appear doable from the Dataverse table, only solutions I find are either to send Reminder emails (which doesnt contain the actionable message) or to Timeout the approval and create new (which spams the Sender of approvals).
Any thoughts to share?
Tomasz Poszytek
Well, with Follow up there’s nothing oob as you noticed. And it’s either building your custom solution, that may include actionable messages too and a custom flow to complete tasks, or no actionable message, or the timeout to start approval again.
Nikhil
Hi Tomasz, to update the Dataverse we need a premium license right. So is there a way to do it without premium license?
Tomasz Poszytek
I think you answered yourself this question 🙂 Nope, you need premium license. Or use Logic Apps, but then you need Azure subscription.
Clark
Hi Tomasz, thank you for your sharing.
I noticed that on the approval flow there is a “Name” column with blank value. May I know why does it blank?
And if I want to delete records in Approval table (All of them), does it have any effect to my approval system?
Tomasz Poszytek
That is a good question why this column, despite that it’s required, is blank. No idea though 😉 Speaking about data deletion – nope, it has no impact on the approvals solution. You are just going to delete data.
Sam Norman
Hi Tomasz!
Really appreciated and helpful article. I’m trying to reassing some approvals. When creating the new approval record in the approval requests table, I’m getting this error response:
“A record already exists with the attribute values Index id. Approval, Owner User Index, Reassignment Source Index, Phase Index. The Uniqueness Constraint Index entity key requires that this set of attributes contain unique values. Please select unique values and try again.”
However, the row is created on the table and I can see the the new approval request in the approvals tab of the new owner. Anything I’m missing out?
Thank you!
Tomasz Poszytek
I actually haven’t seen such an issue. I may understand the reason why it’s showing up. Maybe you are not deactivating the existing record first?
Dmitry
Hi Tomasz
I was able to do everything you talk about here. Big koodos to you for making this post!
The only thing I can’t figure out is when completing the task normally (from teams or outlook) once the task is completed, you get a teams notification (as a requestor) reading “Final Status: Completed”.
When I do it with your method, the task completed normally and approval wait action is completed ok, but I do not get the “Final Status: Completed” notification.
I am wondering if you have encountered anything similar.
Appreciate your help!
Tomasz Poszytek
Yes, unfortunately you won’t be seeing that “natural” behavior when completing tasks via Dataverse manipulation. There is possibly something more happening on the API level, that I am not aware of.
Shyam bhandaru
Hi Tomasz,
I am updating the Approval, response, and flow table using power app. working fine but the Avtivty card is not showing the response . Srill showing “Pending response”
thanks,
Shyam
Tomasz Poszytek
What do you mean by “activity card”? What do you want to achieve?
Ray Garza
Hi Tomasz,
Is there a tool to perform Approval audits, or does one need to be created?
For instance, I have an application and send approval notifications to five departments. I process the responses as they arrive. Later, I need a report of when the approver was notified, when they responded (if at all), and what the response was.
Thanks,
Ray
Tomasz Poszytek
Hi, there is no tool that provides such functionality that I know. I suppose it can be done using a Power Bi report on top of Microsoft Dataverse.
Praveen B
Hi Tomasz, I tried to reassign approval tasks with dataverse and power automate. When I check my sent approvals, I can see the reassignment, but the person who is supposed to get the reassignment task, is not seeing the approval in the teams app, nor in the power automate approvals. The person is having admin role, approver user role as well as system customiser role.
Tomasz Poszytek
Be sure the person to whom the task is reassigned has access to the Approvals record: https://poszytek.eu/en/microsoft-en/office-365-en/powerautomate-en/power-platform-tasks-reassignment-permissions/.
Stephanie Anderson
Hi Tomasz,
I am trying to update an approval to be set as expired when my flow hits the 30 day time out threshold.
Is there a way update the approval to show as expired though the Dataverse?
I tried setting the Status Reason on the Approval table to Expired but it is still showing as the normal pending status to the users.
Thank you
Tomasz Poszytek
Nope, there’s no such thing as “Expired” in Dataverse. No such status. Tasks in Dataverse do not expire, those are only Power Automate flows that do. You can only set it’s status to Inactive, so that it’s not visible to users.
Nanette
Great article, Tomasz! This will go a long way for me to update the status of the task without using the OOB approval action in Teams.
However, I do have another question.
How can I find the name of the person the task is assigned to? In my scenario, I have a workflow that assigns a task and needs to send a reminder to the task owner a few days later. But what if the owner reassigned the task? How can I find the name of the current assigned user so I can send the reminder to the right person?
Tomasz Poszytek
This is always the “Owner” of the Approval Request record.
Heiko Mock
Hi Tomasz,
I have followed your instructions, but everytime I Reassign an approval task the Reassigned From keeps being empty and the Reassigned From Index is always .
I need to find the new assignee for a task, but I think without these values it is impossible. The card shows everything correctly. Am I missing something or is there another table (not explained) holding this information?
Cheers,
Heiko
Tomasz Poszytek
You need to assure that when creating a new task, assigned to a new assignee, you populate it with details of the “reassigned” from. This is not done automatically.
Iain Ray
Hi Tomasz, did you ever work out how to control what icon appears in Teams approvals under Source, for example you get the Approvals App Icon, if the approval is created using the +New approval request button, but cant see anywhere to change or add the icon in the Approval dataverse table?
Thanks for all you work btw 🙂
Tomasz Poszytek
The only thing I found out is that it is set automatically if the approval source is Approvals. There is no icon for other sources. It looks like a very hardcoded thing in the UI.
Randall Polasek
Hello, I am trying to apply the following row filter: msdyn_flow_approvalrequestidx_reassignedfromid ne ” and the field is always even though tasks are reassigned.
Tomasz Poszytek
I am unsure whether those tasks reassigned using UI are having this field populated.
Randall Polasek
Correction, filter row is ” msdyn_flow_approvalrequestidx_reassignedfromid ne ””