locked
Async, service.Associate( RRS feed

  • Question

  • Hi Forum

    I use the code below.

    _service.Associate(
                           Team.EntityLogicalName,
                           _teamId,
    new Relationship("teamroles_association"),
    new EntityReferenceCollection() { new EntityReference(Role.EntityLogicalName, _roleId) });

    But it seems to be async, that means if I immediately after calling "service.Associate" tries to assign the team to a Account entity, it fails beacuse the team doesn´t have the right privileges. If i wait 2 seconds it works.

    Do anybody have a good idea how to solve this? Why didn't MS make a Sync service also or give the opportunity to add a callbackfunction to the parameterlist. ?

    br

    henrik

                                                 

    --- Best regards Henrik Skydtsgaard

    Tuesday, September 2, 2014 12:26 PM

All replies

  • Please assign appropriate security role to the Team

    Regards Faisal

    Tuesday, September 2, 2014 12:38 PM
  • I do that,  but it takes some time for the privileges to propagate to the team and when I then assign the team as owner of an Account - this happens

    System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault], fejlbesked: Principal team (Id=abdc6c95-9b32-e411-80d9-005056b864fe, type=9) is missing prvReadAccount privilege (Id=886b280c-6396-4d56-a0a3-2c1b0a50ceb0)

    Then I wait two seconds and tries again - it works.

    /henrik


    --- Best regards Henrik Skydtsgaard

    Tuesday, September 2, 2014 12:44 PM
  • Microsoft has an article about it

    http://msdn.microsoft.com/en-us/library/gg327897.aspx

    Is this really the way to do this (wait half a second and try again?)


    --- Best regards Henrik Skydtsgaard

    Tuesday, September 2, 2014 12:45 PM