Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

GrantAccessRequest doesn't share records sometimes

Posted on by

Hi,

I'm using the GrantAccessRequest class to share records with users/teams within a custom workflow activity, but sometimes it doesn't share the record but the workflow status is succeed and the code doesn't throw any exception.

We create the records that trigger the workflow with a custom application that syncs the data from NAV to Dynamics 365. 

I've seen the class documentation says: For this message to work, the caller must be connected to the server

  1. I don't totally get what means: For this message to work, the caller must be connected to the server, the caller would be the user we use with the custom sync app?
  2. Is there any other way to share records?
  3. Any way to find out if GrantAccessRequest doesn't share the record?

*This post is locked for comments

  • Verified answer
    Emre GULCAN Profile Picture
    Emre GULCAN 2,379 on at
    RE: GrantAccessRequest doesn't share records sometimes

    Hi,

    As SDK documentation of GrantAccessResponse (msdn.microsoft.com/.../microsoft.crm.sdk.messages.grantaccessresponse.aspx) "There is no return value from this operation", so you can't handle any response. However if your request is faulted there is an exception occurs when you execute this request.

    Maybe you doing something wrong, please check your code and replace it sample below;

    GrantAccessRequest request = new GrantAccessRequest()
                {
                    PrincipalAccess = new PrincipalAccess()
                    {
                        Principal = new EntityReference("systemuser", Guid.Parse("YOUR_SYSTEMUSER_ID")),
                        AccessMask = AccessRights.AppendAccess | AccessRights.AppendToAccess | AccessRights.AssignAccess | AccessRights.CreateAccess | AccessRights.DeleteAccess | AccessRights.ReadAccess | AccessRights.ShareAccess | AccessRights.WriteAccess
                    },
                    Target = new EntityReference("YOUR_ENTITY_LOGICALNAME", Guid.Parse("YOUR_ENTITY_RECORD_ID"))
                };


  • Jorge S Profile Picture
    Jorge S on at
    RE: GrantAccessRequest doesn't share records sometimes

    No exception.

    I'm trying to get the reponse from

    GrantAccessResponse response = (GrantAccessResponse)service.Execute(grantRequest);

    but both response.Results.Keys and response.Results.Values are empty.

  • Emre GULCAN Profile Picture
    Emre GULCAN 2,379 on at
    RE: GrantAccessRequest doesn't share records sometimes

    Hi

    Did you get any exception? Maybe your users don't have valid privilege on entity

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans