Assembly must be registered in isolation error while trying to register plugin \ custom workflow activity in Isolation Mode None in Dynamics 365 On Premise CE

Hi Folks,

Recently I was trying to move the Plugins within a solution to another environment where I started to face the above mentioned error.

After checking found that the user who is deploying solution didnt have deployment administrator role. For this we need to provide Deployment administrator to the user who was actually deploying the solution, you will find deployment manager for your Dynamics Onpremise instance.

Once deployment administrator role is added, you should be able to move the solution.

Reference: Link

Cheers,

PMDY

Granting Access to a Business unit Team via C#

Hi Folks,

I hope there isn’t any one who doesn’t know about security roles and access privileges being in Dynamics space. Most of the people should be aware of doing this via application, in this post, sharing one simple way to grant access to the records using C# code. Please use the below code to achieve the same.

private void ShareRecordtoBUTeamofRequestorUser(Guid Targetid, Guid TargetShare, IOrganizationService orgService)
        {
            try
            {
                if (Targetid != null && TargetShare != null)
                {
                    GrantAccessRequest grant = new GrantAccessRequest();
                    grant.Target = new EntityReference(MetadataHelper.VolunteerList.EntityLogicalName, Targetid);

                    PrincipalAccess principal = new PrincipalAccess();
                    principal.Principal = new EntityReference(MetadataHelper.Team.EntityLogicalName, TargetShare);
                    principal.AccessMask = AccessRights.ReadAccess;
                    grant.PrincipalAccess = principal;

                    try
                    {
                        //GrantAccessResponse grant_response = (GrantAccessResponse)orgService.Execute(grant);
                        orgService.Execute(grant);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

I have commented below lines in try block above and avoid using them because you will get an error for the same…

GrantAccessResponse grant_response = (GrantAccessResponse)orgService.Execute(grant);

An unhandled exception has occurred during execution of the plugin.
An error occured while getting default Team of Requestor BusinessUnit[A]Microsoft.Crm.Sdk.Messages.GrantAccessResponse cannot be cast to
[B]Microsoft.Crm.Sdk.Messages.GrantAccessResponse. Type A originates from ‘Microsoft.Crm.Sdk.Proxy, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ in the context ‘Default’ at location ‘C:\Microsoft.Crm.Sdk.Proxy.dll’. Type B originates from ‘Hisol.SCS.CRM.Plugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bb2727b96c9cb15e’ in the context ‘LoadNeither’ in a byte array.

Thank you.

Cheers,

PMDY