Set PartyList field To in Email in CRM 2015 (and earlier)


Sample code to set the PartyList field for Email Activity.


function setContact() {

var partlistData = new Array();
partlistData[0] = new Object();

// guid of the record
partlistData[0].id = "8B2AD82B-30D6-E511-811F-3863BB356F90";

// name of the record
partlistData[0].name = "Hugh Grant";

// entity schema name
partlistData[0].entityType = "contact";
Xrm.Page.getAttribute("to").setValue(partlistData)

}

Hope it helps..

The selected translations file is either invalid or does not conform to the required translations file schema error while importing translations in CRM 2015 (and earlier)


Hi,

While importing translations we got the below error

On opening the CrmTranslations.xml we saw the translations missing for that row.

On specifying the values for those fields and importing it back fixed the issue.

Hope it helps..

Plugin on update of Quote Detail in CRM 2015 firing on Quote Create Issue.


Hi,

We were facing one issue recently on creating Quote, where in we were getting exception on our Plugin that was registered in Post Update of Quote Detail.

It was kind of surprise for us that why it was getting triggered.

We removed all our others plugin and workflow on Quote and Quote Line but still that plugin was getting triggered. So we thought of trying it out on Vanilla instance of CRM 2016. In case of CRM 2016 the plugin registered on Post Update of Quote Detail didn’t trigger.

We then tried it on Vanilla instance of CRM 2015 On Premise (no online available), and we saw the same case i.e. Plugin getting triggered.

We were getting the following detail on Context.ParentContext (in case where Plugin on Update of Post Quote Detail is asynchronous)

                     Message – Update

         Stage – 30

         EntityReference (Target) – Quote

For Synchronous the message will be Retrieve

Hope it helps..

Import Solution progress bar rolls back without any error in CRM 2015\CRM 2013 Online.


Hi,

Occasionally while importing the solution to our UAT environment we have faced this issue where the solution hasn’t imported, didn’t give any error but has rolled back.

This issue seems to be occurring when we are facing Network Issues and Internet connection intermittently goes down.

Trying it again once the network is stable resolves this.

Hope it helps..

Unit Testing (Microsoft Fakes) RetrieveSharedPrincipalsAndAccessResponse in Plugin in CRM 2016 (and earlier)


Hi,

While trying to write Fakes for RetrieveSharedPrincipalsAndAccessResponse we’d realize that PrincipalAccess is read only property and the class itself is sealed.

So to unit test it we need to write a wrapper class as suggested here

http://alexanderdevelopment.net/post/2013/10/17/unit-testing-custom-microsoft-dynamics-crm-code-part-4/

The wrapper class


/// <summary>
/// Wrapper class for retrieve response
/// </summary>
[DataContract(Namespace = "http://schemas.microsoft.com/xrm/2011/Contracts")]
public class RetrieveSharedPrincipalsAndAccessResponseWrapper : OrganizationResponse
{
/// <summary>
/// The _entity
/// </summary>
private PrincipalAccess[] _principalaccess;

/// <summary>
/// Initializes a new instance of the <see cref="RetrieveResponseWrapper"/> class.
/// </summary>
/// <param name="response">The response.</param>
public RetrieveSharedPrincipalsAndAccessResponseWrapper(OrganizationResponse response)
{
try
{
this.PrincipalAccesses = ((RetrieveSharedPrincipalsAndAccessResponseWrapper)response).PrincipalAccesses;
}
catch
{
this.PrincipalAccesses = ((RetrieveSharedPrincipalsAndAccessResponse)response).PrincipalAccesses;
}
}

/// <summary>
/// Gets or sets the PrincipalAccesses.
/// </summary>
/// <value>
/// The entity.
/// </value>
public PrincipalAccess[] PrincipalAccesses
{
get
{
return _principalaccess;
}

set
{
_principalaccess = value;
}
}
}

The unit test


 organizationService.ExecuteOrganizationRequest = request =>
 { 
 RetrieveSharedPrincipalsAndAccessResponseWrapper retrieveResponseWrapper = new RetrieveSharedPrincipalsAndAccessResponseWrapper(new RetrieveSharedPrincipalsAndAccessResponse());
 PrincipalAccess[] principalAccess = new PrincipalAccess[1]; 
 PrincipalAccess pAccess = new PrincipalAccess();
 pAccess.AccessMask = AccessRights.CreateAccess;
 pAccess.Principal = new EntityReference("team", new Guid("9A69533A-2306-4DFC-9662-65ABFAB41348"));
 principalAccess[0] = pAccess;
 retrieveResponseWrapper.PrincipalAccesses = principalAccess; 
 return retrieveResponseWrapper;
 };

 

Change in the Plugin code using Wrapper instead of original class



 IOrganizationService orgService = serviceFactory.CreateOrganizationService(context.UserId);

 var accessRequest = new RetrieveSharedPrincipalsAndAccessRequest
 {
 Target = new EntityReference("projectsite", new Guid("CDF30DD5-C64E-4EF5-ABA6-C9715C10A07D"))
 };

 RetrieveSharedPrincipalsAndAccessResponseWrapper accessResponse = (new RetrieveSharedPrincipalsAndAccessResponseWrapper(orgService.Execute(accessRequest)));

Hope it helps

The type or namespace name ‘RSASignaturePadding’ does not exist in the namespace ‘System.Security.Cryptography’ (are you missing an assembly reference?) in Unit Test Project.


Was getting the below error while trying to build a unit test project (framework version 4.5.2) in VS 2012.

Delete the .messages file as suggested in some forums, but that didn’t help.

Just tried building the project by changing the Target Framework to 4.6.

That worked and after that on switching back the target version to 4.5.2 also worked.

Helpful post

https://social.msdn.microsoft.com/Forums/vstudio/en-US/2de45cd4-2744-4a91-91a2-785f305c1ef7/errors-on-trying-to-add-fakes-assembly-on-system?forum=vsunittest

Hope it helps..