locked
CRM 2011 how to get the whole number value RRS feed

Answers

All replies

  • Hi,

    Would you please elaborate further? your requirement is not clear. if you want to read the whole number fields value then use below JavaScript.

    var wholeNumber= Xrm.Page.getAttribute("CRMFieldSchemaName").getValue() ;

    HTH!

    Thanks!

    Thursday, October 3, 2013 5:05 AM
  • Hi

    Hi

    Thanks for your reply, I am passing the one enity to another entity while selecting the lookup values... Text values am able pass properly.. and  whole number values not able to pass can see the below code and suggest it

    /********************************************************************
    Passing the Paramaters from Cover entity to cover applicable entity
    /********************************************************************/

    function CompanyInformation()
      {
           var PolicyNumber = Xrm.Page.getAttribute("customerid").getValue();
           if (PolicyNumber != null)
            {
               var PolicyNumberId = PolicyNumber[0].id;
               var Fields = PerformRetrieve("account", PolicyNumberId )
                  if (Fields != null)
                    {
             //   var accounttype = Fields.selectSingleNode("//q1:" + 'hcaccounttype').nodeTypedValue;
             //    var accountTypeValue=accounttype.getAttribute("value");
            //    var Accountcategory = Fields.selectSingleNode("//q1:" + 'accountcategory').nodeTypedValue;
             //   var AccountcategoryValue=Accountcategory.getAttribute("value");
           //     var Industry= Fields.selectSingleNode("//q1:" + 'industrycode');//.nodeTypedValue;
         //       var IndustryValue=Industry.getAttribute("value");
              //  var NumberofyearsofBusiness=Fields.selectSingleNode("//q1:" + 'noofyearsinbusiness').nodeTypedValue;
               // var NoValue=NumberofyearsofBusiness.getAttribute("name");
                var Phone=Fields.selectSingleNode("//q1:" + 'hcl_phone').nodeTypedValue;
                var websiteurls=Fields.selectSingleNode("//q1:" + 'websiteurl').nodeTypedValue;
               var Faxs=Fields.selectSingleNode("//q1:" + 'hcl_fax').nodeTypedValue;

       //Assigning the values

           //    Xrm.Page.getAttribute("new_accounttype").setValue(accountTypeValue);
             //  Xrm.Page.getAttribute("new_accountcaetegory").setValue(AccountcategoryValue);
          //     Xrm.Page.getAttribute("industries").setValue(IndustryValue);
             //  Xrm.Page.getAttribute("new_noofyearsinbusiness").setValue(NoValue);
              Xrm.Page.getAttribute("companyinfophone").setValue(Phone);
              Xrm.Page.getAttribute("twebsite").setValue(websiteurls);
              Xrm.Page.getAttribute("tfax").setValue(Faxs);

                 }
           }

       }

    function PerformRetrieve(entityName, EntityGuid)
     {
        var res = null;
        var authenticationHeader = GenerateAuthenticationHeader();
        var xml = "<?xml version='1.0' encoding='utf-8'?>" +
    "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'" +
    " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" +
    " xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" +
    authenticationHeader +
    "<soap:Body>" +
    "<Retrieve xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>" +
    "<entityName>" + entityName + "</entityName>" +
    "<id>" + EntityGuid + "</id>" +
    "<columnSet xmlns:q1='http://schemas.microsoft.com/crm/2006/Query' xsi:type='q1:ColumnSet'>" +
    "<q1:Attributes>" +
     "<q1:Attribute>" + "phone" + "</q1:Attribute>" +
    "<q1:Attribute>" + "websiteurl" + "</q1:Attribute>" +
    "<q1:Attribute>" + "fax" + "</q1:Attribute>" +

    "</q1:Attributes>" +
    "</columnSet>" +
    "</Retrieve>" +
    "</soap:Body>" +
    "</soap:Envelope>";
        // Prepare the xmlHttpObject and send the request.
        var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
        xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
        xHReq.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Retrieve");
        xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
        xHReq.setRequestHeader("Content-Length", xml.length);
        xHReq.send(xml);
        // Capture the result.
        var resultXml = xHReq.responseXML;

        // Check for errors.
        var errorCount = resultXml.selectNodes('//error').length;
        if (errorCount != 0) {
            var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
            alert(msg);
        }
        // Display the retrieved value.
        else {
            //res = resultXml.selectSingleNode("//q1:" + columns).nodeTypedValue;
            res = resultXml;
        }

        return res;
    }


    Rammohan

    Thursday, October 3, 2013 5:29 AM
  • while setting values i think fields like tcompanyinforphone, twebsite and tfax should be new_tcompanyinforphone, new_twebsite and new_tfax

    Regards Faisal

    Thursday, October 3, 2013 7:10 AM
  • Hi

    Tfax,website are the Text feilds

    new_companyphone number is whole number. so it's not able to identify while passing the one  enity to another entity

    i can able to pass the text values but not able to pass whole number alone

    can you suggest it now

    I hope you are clear now


    Rammohan

    Thursday, October 3, 2013 7:15 AM
  • try

    var Phone=parseInt(Fields.selectSingleNode("//q1:" + 'hcl_phone').nodeTypedValue);


    Regards Faisal

    Thursday, October 3, 2013 7:38 AM
  • thanks it's working fine for Whole number and Option set also.


    Rammohan

    Thursday, October 3, 2013 11:07 AM