Skip to main content

Notifications

Announcements

No record found.

Sharing Dynamics 365 Records using Unbound Actions in Power Automate

Have you taken a look at the new Common Data Service (Current Environment) connector within Power Automate?

 

 

If so, you may have seen some of the new actions you have available to you, when built within the context of a solution. More specifically Bound and Unbound Actions.

 

Recently, I had the need to automatically share records to an Owner team after creation, but identifying the proper format wasn't very straight forward. So I wanted to outline the steps below:

 

In order to use this connector, you must be within the context of a solution. When you use this connector, you will have multiple options to trigger the Flow compared to the standard CDS connector

 

8311.pastedimage1584396464112v1.png

 

 

In this case, I am choosing the trigger on Create. Then, you will search again for the Common Data Service (Current Environment) connector. This time it will give you the different actions. Since this action is not bound to an entity, we are going to chose Perform an unbound action.

 

pastedimage1584449450403v2.png

 

Then, I can search for my action. 

 

7206.pastedimage1584396464124v2.png

 

The format for the Target needs to be entitylogicalname(recordid), which you can pull as a Dynamic value from the creation trigger, in this case.

 

pastedimage1584449488834v3.png

 

 

Below, you will see the proper formatting for the input values of PrincipalAccess. This is where I initially ran into issues with formatting. This needs to be in JSON format to provide the user or team that will be granted access to the record and the Access Mask for the privilege they will receive. You need to escape the @symbol for odata.type in order for this to be recognized as proper JSON format.

 

0363.pastedimage1584396464133v3.png

 

 

Here is some additional documentation on the GrantAccess action.

 

I hope this helps.

 

Aaron Richards

Comments

*This post is locked for comments

  • ChadAlt Profile Picture ChadAlt 367 User Group Leader
    Posted at
    For anyone that needs a little more help, I compiled more detailed information with code snippets you can copy/paste at the link below, and I cover both GrantAccess and RevokeAccess. www.chadalthaus.com/.../unbound-actions-how-to-share-and.html Many thanks to you, Aaron, for this first post! It gave me direction in a documentation-less world. [emoticon:44a8a53ad3364ea78a16c5a3229f75bb]
  • Community Member Profile Picture Community Member Microsoft Employee
    Posted at
    Aaron: This isn't working for me. I followed your example exactly except I'm granting access to a user instead of a team. I'm getting a lengthy error which starts with "An error occurred while validating input parameters: Microsoft.Crm.CrmHttpException: Resource not found for the segment 'opportunity'.\r\n at Microsoft.Crm.Extensibility.OData.CrmEdmEntityReference." We would like to use this technique to grant or revoke access to certain opportunity records. In our Opportunity entity, Opportunity Name (opportunityid) is the primary key and contains the record GUID. My Perform an Unbound Action has the following parameters: Action Name: GrantAccess Target: opportunity(triggerBody()?['entity']?['opportunityid']) (I'm actually using dynamic content and am inserting the Opportunity Name field from the Trigger. The triggerBody expression shown above is how Power Automate converts the dynamic content.) Principal Access: { "Principal": { "systemuserid": "2b8223d0-6be1-ea11-a820-000d3a19b9a8", "@@odatatype": "Microsoft.Dynamics.CRM.systemusers" }, "AccessMask": "ReadAccess" } It looks like it is never getting past the target. The flow is in a solution in our Sandbox environment. It acts like it can't find the opportunity entity. I've checked the record GUID and everything should be there. Any ideas why I might be getting this error? Any troubleshooting tips? Also, do you know what belongs in the Revokee field for the RevokeAccess action? Microsoft documentation was not helpful. Thanks!
  • Ahmed Adly Profile Picture Ahmed Adly
    Posted at
    Thanks Aaron, Do you know What is the parameters required to RevokeAccess action ? - the Microsoft documentation is very confusing
  • AaronRic Profile Picture AaronRic 10,035
    Posted at
    Hi Martin, yes this will work for a custom entity. You should be able to replace teamid with systemuserid and the odata.type with Microsoft.Dynamics.CRM.systemusers
  • Martin CPA Profile Picture Martin CPA 45
    Posted at
    This is really useful, thank you. Do you know if it will work with a custom entity? Also, can you advise on how to modify to work for a userid rather than a teamid? I cant seem to find any guidance in the samples. Thanks
  • Community Member Profile Picture Community Member Microsoft Employee
    Posted at
    In this unprecedented times lot of content is created around #COVID19 to help the community. Organizations