Monthly Archives: June 2011

Set Default Price list in MS CRM 2011 using Java Script

if you want to set default price list with help of java script, you can use Rest, below is the code to fetch pricelist id based on pricelist name and set it
function SetPriceList() {

var number = 1;
var filter = “/PriceLevelSet?$select=Name,PriceLevelId&$filter=Name eq ‘Default'”;
RetrieveUnit(filter);
}
function GetODataPath() {

return Xrm.Page.context.getServerUrl() + “/xrmservices/2011/organizationdata.svc”;
}
function RetrieveUnit(filter) {

var retrieveRecordsReq = new XMLHttpRequest();
retrieveRecordsReq.open(“GET”, GetODataPath() + filter, false);
retrieveRecordsReq.setRequestHeader(“Accept”, “application/json”);
retrieveRecordsReq.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);
var temp= retrieveRecordsReq.send();
if (retrieveRecordsReq.readyState == 4 && retrieveRecordsReq.status == 200) {
var retrievedRecords = this.parent.JSON.parse(retrieveRecordsReq.responseText).d;
var Result = retrievedRecords.results[0];
var lookup = new Object();
var lookupValue = new Array();
lookup.id = Result.PriceLevelId;
lookup.entityType = “pricelevel”;
lookup.name = Result.Name;
lookupValue[0] = lookup;
Xrm.Page.getAttribute(“pricelevelid”).setValue(lookupValue);
}
}
*I have created a Default pricelist.

Enjoy !!

17 Comments

Filed under MS CRM 2011

MS CRM 2011 Developer Training Kit released

MS CRM 2011 training kit is released. you can download it from below URL

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=78498c29-28ac-440b-9c20-ec5da6ee6e98&displaylang=en

Happy Learning….!!!

Leave a comment

Filed under MS CRM 2011

“Unable to access the MSCRM_CONFIG database. SQL Server does not exist or access denied” Error

If you are getting below error while trying to access MS CRM 2011 deployment manager

check if “SQL Server Agent” service is running or not, if not just start this services and then try

Enjoy!!

1 Comment

Filed under MS CRM 2011

Getting Parent Entity Information from child

In MS CRM 4.0 we used to get parent entity information using window.opener which is not there in CRM 2011 now. In CRM 2011 you can use below code

window.top.opener.parent.Xrm.Page

so using this statement you can get parent entity information and can fetch parent entity data, but sometime we also need to check parent entity name, let’s take an example of order, we can create order from opportunity form, we can create it from account form as well. So in that case if we need to check which is the parent entity in order form we can use below statement to check entity name

if(window.top.opener.parent.Xrm.Page.data!=null)
var EntyName=window.top.opener.parent.Xrm.Page.data.entity.getEntityName();

enjoy !!

Reference

9 Comments

Filed under MS CRM 2011

MS CRM 2011 Virtual Machine

If you are a Microsoft partner you can download MS CRM 2011 Virtual Machine from
https://mbs.microsoft.com/Cms/Templates/document/General.aspx?NRMODE=Published&NRNODEGUID={060C9677-229D-49E1-9F00-95E56D9F1657}&NRORIGINALURL=/partnersource/deployment/methodology/vpc/MSD_CRM2011VirtualMachine&NRCACHEHINT=Guest&w&wa=wsignin1.0

Enjoy !!

3 Comments

Filed under MS CRM 2011

‘Sys’ is undefined error while using Ajax 4.0 and Visual studio 2010

We used Ajax in one of our ISV application and when we deployed it in Production server, we started facing this issue, after doing a search in google, I found I need to do changes in my webconfig file to make ajax enabled, as we used vs 2010, so these entries were not there in our webconfig file. So we created one sample website in VS 2008 and all required configuration was there in webconfig. Then we copied these required configuration in our ISV application and deployed to production server, then we started getting another error

“There is a duplicate ‘system.web.extensions/scripting/scriptResourceHandler’ section defined”

After commenting this section it worked perfectly.

Enjoy!!

Leave a comment

Filed under Ajax