Retrieving pricelist entity data in crm 2013 using odata RRS feed

  • Question

  • Hi,

           I am using crm 2013, i have two entities Quote and PriceList. In quote i have two fields. 'product' and 'product amount'. Product is a lookup filed and it is pointing to PriceList entity. 'product amount' is currency field. When i select a product in lookup field, we need to get the price of that product from pricelist entity and need to be update in the 'product amount' field of Quote entity.

    for this i am using the below code.


    function retrieverecord() {
    alert('retrieverecord start');
      if (Xrm.Page.getAttribute("pricelevelid").getValue() != null) 
         var pricelevelID = Xrm.Page.getAttribute("pricelevelid").getValue()[0].id;
    var pname=document.getElementById("pricelevelid").innerText;
    alert('hi '+pname);

    var amount;
    var serverUrl = window.parent.Xrm.Page.context.getClientUrl();
    var oDataSelect = serverUrl + "/XRMServices/2011/OrganizationData.svc/AccountSet?$select=telephone2&$filter=name eq 'test'";
    var retrieveReq = new XMLHttpRequest();
    retrieveReq.open("GET", oDataSelect, false);
    retrieveReq.setRequestHeader("Accept", "application/json");

    retrieveReq.setRequestHeader("Content-Type", "application/json;charset=utf-8");
    retrieveReq.onreadystatechange = function () {

    if (retrieveReq.readyState == 4){

    var retrieved = parent.JSON.parse(retrieveReq.responseText).d;

    if (retrieved != null) {
    alert('not null');
    //productrange= productrange+ retrieved.results[0].new_ProductRange_value;

    alert('Amount is:'+amount);

    But i am not getting the Product amount into quote entity.

    Please help me if anyone have any idea on this.


    Tuesday, December 24, 2013 6:07 PM

All replies