Find the current and previous user of a reassigned approval flow from the Common Data Service (CDS): Part 2

Share the love

My last post, Capturing a reassigned approval flow from the Common Data Service (CDS), detailed how you can find a reassigned approval request in the Common Data Service, however, I did not detail how you get the user details.

Last time, my flow triggered every time a new request was created in the CDS (which is the easiest way to capture reassigned flows). This post will pick up from there, or you can follow this post independently if you don’t want to trigger each time a new request is created.

To get the Approval Request that has been reassigned, list all the records from the Approval Requests entity and filter on the Approval ID and the Owner ID. In my action, the ApprovalRequest parameter is a value that is passed in from another flow (or it would be the ID of the request that triggered the flow if you’re following on from the last post). If you have this value already in your log, you can place this value here. The Owner ID is the GUID of the user with whom the approval flow has been reassigned to. If you’re following on from the last post, this is the value from the Reassigned From field (msdyn_flow_approvalrequestidx_reassignedfromid) in the Approval Request entity. If you’re creating this flow independently, it is quite possible you don’t have the Owner ID, so in this case, ordering by the msdyn_flow_approvalrequest_lastnotifiedon in descending order will be your best chance at finding the reassigned user.

I have used the current Owner ID in a previous action in this flow (Get record – Get response user which gets information from the Users entity) so I can pull additional information about the user later (however you do not need to do this). I have used the User ID parameter from the previous action in the query below.

msdyn_flow_approvalrequestidx_approvalid eq 'triggerBody()?['text_3']' and msdyn_flow_approvalrequestidx_owninguserid eq 'outputs('Get_record_-_Get_response_user')?['body/systemuserid']'

Even though we said to only return one result, we will still need to access the array of results. The value that we are after is msdyn_flow_approvalrequestidx_reassignedfromid. This is the ID of the user who reassigned the flow.


Now we have the record of the reassigned flow, and the flow that was used to reassign to another user. In order to get the details of the user who reassigned the flow, we need to use the Users entity and pass in the Owner ID of the previous action (Get record – Get previous request).


Now that you’ve got the Users entity, this gives you access to the users email, phone numbers, addresses etc. We can use this information to update the workflow log with who the flow was originally assigned to, and who it is now assigned to. In my example, I have used JSON.

  "reassign": [
      "responder": {
        "id": "outputs('Get_record_-_Get_previous_owner')?['body/systemuserid']",
        "displayName": "outputs('Get_record_-_Get_previous_owner')?['body/fullname']",
        "email": "outputs('Get_record_-_Get_previous_owner')?['body/internalemailaddress']"
      "responseDate": "outputs('List_records_-_Get_current_request')?['body']?['value']?[0]?['modifiedon']",
      "approverResponse": "Reassigned"
  "reassigned": [
      "reassigned": {
        "id": "outputs('Get_record_-_Get_response_user')?['body/systemuserid']",
        "displayName": "outputs('Get_record_-_Get_response_user')?['body/fullname']",
        "email": "outputs('Get_record_-_Get_response_user')?['body/internalemailaddress']"

Share the love

2 Replies to “Find the current and previous user of a reassigned approval flow from the Common Data Service (CDS): Part 2”

  1. Hello SharePointCass,
    I work for an electronics company, and we’ve been using SharePoint Online for our Doc Mgmt system. I have a workflow set up, manually triggered, to route documents to various Approvers for review & approval. I’m allowing Reassignments but, as you know, they are difficult to track/monitor. I really like your recommendation to setup an automated workflow using Dataverse (formerly CDS) to capture the reassignments when they happen.
    What I would like to do and where I need some help, is after an Approver reassigns his/her approval to someone else, automatically feedback that information to the Document owner (via e-mail), which is the Workflow initiator in this case. The information I’d like to have sent automatically to the Doc owner: 1) which one of his/her Approvers reassigned their approval, and 2) to whom. The heart of my problem is how to find the Doc owner in Dataverse, or perhaps how to “link up”/”bring in” the Doc owner/document-under-review into the automated workflow.
    Any help would certainly be appreciated.
    Thanks & Regards,
    David Twigg

    1. Hi David, thanks for your comment. Reassignments are definitely tricky. If I understand correctly, you want to notify the document owner when an approval on the document has been reassigned? Are you capturing the document owner in the metadata? Or is it the created or modified user? If you are, you can query the document metadata separately after the reassignment is captured. Perhaps this article could help? The document that you are looking for should be referenced in the Approval Dataverse tables. Hopefully this helps!

Leave a Reply

Your email address will not be published. Required fields are marked *