How to split a record in MS Dynamics CRM using a workflow

I would like to do the following:

when the seller assigns a custom object (call him “Primary Expertise”) to Opportunity in MS CRM 4.0, the system will share the option with the user, which is defined as the Owner of the associated “Primary Expertise”, record.

I would like to do this automatically through a workflow, but I cannot find a workflow step that would do this. Yes, and I read on some forums that this is not yet possible, only through the .NET assembly.

Experience anyone?

+3
source share
4 answers

, .NET. ( CRM 4) , ?

+3
+4

If you decide to go with a custom plugin, your code might look like this:

var rights = AccessRights.ReadAccess | AccessRights.WriteAccess;

var principalAccess = new PrincipalAccess
{
    // Gives the principal read write access
    AccessMask = rights,

    // Set the PrincipalAccess Object Properties
    Principal = sharingTarget.Key
};

// Create the Request Object
var grantAcessRequest = new GrantAccessRequest();
// Set the Request Object properties
grantAcessRequest.PrincipalAccess = principalAccess;
// Set the Target. In my case it is account record
var entityReference = new EntityReference(localContext.PluginExecutionContext.PrimaryEntityName,
                                          localContext.PluginExecutionContext.PrimaryEntityId);
//throw new InvalidPluginExecutionException("EntityReference");
grantAcessRequest.Target = entityReference;

// Execute the Request
localContext.OrganizationService.Execute(grantAcessRequest);
+3
source

All Articles