Below i have attached the document link in this i have put every image and comments to resolve the subjected error.

Associate Entity Type code wrong mapping solution

associcated-entity-type-code-miss-match

 

see-in-developer-tool-xml-mapping-pane

rename-the-document-extension-to-zip

 

look-at-the-folder-structure

time-to-edit-xml-highlighted2

 

time-to-edit-xml-highlighted1

 

 

select-all-content-inside-folder

verify-changes

 

 

Question may occur in your mind that from where you will get the correct “entity object type code” ?

For that you can use “XRM Tool Box metadata browser option.

Happy Learning… 🙂

If you like this post please follow…

 

 

Advertisements

Javascript calls action in CRM

//this function is responsible to set the headers

var setRequestHeaders = function (req, includeFormattedValues, customHeaders) {
req.setRequestHeader(“Accept”, “application/json”);
req.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);
req.setRequestHeader(“OData-MaxVersion”, “4.0”);
req.setRequestHeader(“OData-Version”, “4.0”);
if (!(includeFormattedValues !== undefined && includeFormattedValues !== null && includeFormattedValues === false)) {
req.setRequestHeader(“Prefer”, “odata.include-annotations=\”OData.Community.Display.V1.FormattedValue\””);
}

if (!(customHeaders && customHeaders.constructor === [].constructor)) {
customHeaders = [];
}
customHeaders.forEach(function (h) {
switch (h.key) {
case “Accept”:
case “Content-Type”:
case “OData-MaxVersion”:
case “OData-Version”:
case “Prefer”:
break;
default:
req.setRequestHeader(h.key, h.value);
break;
}
});
},

 

// function name
stringParameterCheck = function (parameter, message) {
if (typeof parameter !== “string”) {
throw new Error(message);
}
},

//Async function

executeCustomAction = function (entityId, entityCollectionName, actionName, parameters, isGlobleAction, successCallback, errorCallback, customHeaders) {
var query = “”, req = “”;
stringParameterCheck(actionName, “MisXrmUtilities.WebAPI.executeCustomAction requires the actionName parameter is a string.”);

if (isGlobleAction !== undefined && isGlobleAction !== null && isGlobleAction !== true) {
stringParameterCheck(entityId, “MisXrmUtilities.WebAPI.executeCustomAction requires the e entityId parameter is a string.”);
stringParameterCheck(entityCollectionName, “MisXrmUtilities.WebAPI.executeCustomAction requires the entityCollectionName parameter is a string.”);
entityId = entityId.replace(“{“, “”).replace(“}”, “”);
query = entityCollectionName + “(” + entityId + “)/Microsoft.Dynamics.CRM.” + actionName;
}
else {
query = actionName;
}

req = new XMLHttpRequest();
req.open(“POST”, getWebAPIPath() + query, true);
setRequestHeaders(req, false, customHeaders);
req.onreadystatechange = function () {
if (this.readyState == 4) {
req.onreadystatechange = null;
switch (this.status) {
case 200:
successCallback(JSON.parse(this.response));
break;
case 204:
case 1223:
successCallback();
break;
default:
errorCallback(JSON.parse(this.response).error);
break;
}

}
};

req.send((parameters !== undefined && parameters !== null) ? JSON.stringify(parameters) : null);
},

 
//==============How to use this function==================//
parametersInJsonFormate = {
ActionInputParameter1: “here is the input”, // Make sure the name maches with the action input parameters
ActionInputParameter2: “anything can be passed”
};
executeCustomAction(entityId, entityCollectionName, actionName, parametersInJsonFormate, false, function(success){
//Success call back
}, function(error){

//Error call back
});

Request message has unresolved parameters.

In CRM when you get this error while calling action. then there may be three reasons behind that

  1. some parameters you are passing wrong. (make sure action name is correctly pass)
  2. your action is not activated
  3. your action name is duplicate and one action is in active mode and other is in draft.(as this is done from CRM side that one has to be in draft only two same name action wont be active at same time.)

 

I will talk about the 3) point. here.

to resolve this you need to delete the draft or other active actions, keep only one.

I have seen by default it will create two action in active mode. that’s fine let it  be

if it gives error while deleting your action then deactivate all the actions which we search on advance fine and then delete all and recreate.

How will you find it ???

Go to advance find and delete the default filters and put you process name contains (your action name) and you will find out there are actually two action with the same name.

How this happened in CRM???

🙂 you may have imported the actions twice in CRM.

A system restart from a previous installation or update is pending, and that setup cannot continue

  1. Open the Windows Registry Editor:
    • Windows XP: Click Start → Run, type regedit and then click OK.
    • Windows Vista / 7: Click Start, type regedit in the Search field and then press Enter.
    • Windows 8: Press the Windows Key + R on your keyboard, type regedit and then click OK.
  2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\.
  3. Find RunOnce registry key under currentVersion folder and Delete That
  4. Do the same thing with the HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\.

delete RunOnce folder in current version folder  from here too.

Then you don’t need to restart your system again and again.

 

 

Fetch XML for getting access “Assign position for User” privilege

This Fetch XML gives “Assign position for User” access privilege  for the current logged in user roles.

 

<fetch>
<entity name=”roleprivileges” >
<link-entity name=”role” from=”roleid” to=”roleid” link-type=”inner” alias=”Role” >
<attribute name=”name” />
<link-entity name=”systemuserroles” from=”roleid” to=”roleid” link-type=”inner” >
<link-entity name=”systemuser” from=”systemuserid” to=”systemuserid” link-type=”inner” >
<filter>
<condition attribute=”systemuserid” operator=”eq-userid” />
</filter>
</link-entity>
</link-entity>
</link-entity>
<link-entity name=”privilege” from=”privilegeid” to=”privilegeid” link-type=”inner” alias=”Privilege” >
<attribute name=”canbebasic” />
<attribute name=”canbedeep” />
<attribute name=”accessright” />
<attribute name=”canbelocal” />
<attribute name=”canbeglobal” />
<attribute name=”canbeentityreference” />
<attribute name=”canbeparententityreference” />
<attribute name=”name” />
<filter>
<condition attribute=”name” operator=”eq” value=”prvAssignPosition” />
</filter>
</link-entity>
</entity>
</fetch>

CA2227 Collection property should be readonly

TypeName: CollectionPropertiesShouldBeReadOnly
CheckId: CA2227
Category: Microsoft.Usage
Message Level: Warning
Certainty: 75%
Breaking Change: Breaking

Cause: An externally visible writable property is a type that implements System.Collections.ICollection. Arrays, indexers (properties with the name ‘Item’), and permission sets are ignored by the rule.

Solution for this is as follows: 

public IList<Account> Account{ get; private set; }

Then we need to use this property in the same class, In derived class this property can be accessible(get). but set will be in the same class only.

Now if we want to set this property from other class then we can create one method in the class where we can use this property for setting purpose.

 this.Account = new List<Account>();

this.Account.Add("Here Add you account object");

Task and Phone Activity Created through the Social Pane CRM 2013/15/16

When I tried to run a post create plugin on any activity (i.e. phonecall,  task, email, etc) that time i was unable to get the regardingobjectid in the target entity.

then I looked into the Audit history of this entity and found out that at time of creation we don’t get the “regardingobjectid”, internally some workflow of something runs and it creates one update audit history, and i found out that update audit history really update the regarding object id.

then i registered  my post create plugin to post update plugin and this solved my problem.