Search This Blog

Friday, February 7, 2014

Using Xrm.Utility.openEntityForm with Parameters

Below is a code which will show how to open new Entity Record and pass parameter to the new form while opening

    var phone1 = Xrm.Page.getAttribute("ap_phone1").getValue();
    var phone2 = Xrm.Page.getAttribute("ap_phone2").getValue();
    var phone3 = Xrm.Page.getAttribute("ap_phone3").getValue();
    var phonetype1 = Xrm.Page.getAttribute("ap_phone1type").getValue();
    var phonetype2 = Xrm.Page.getAttribute("ap_phone2type").getValue();
    var phonetype3 = Xrm.Page.getAttribute("ap_phone3type").getValue();

   var parameters = {};

    parameters["ap_phone1"] = phone1;
    parameters["ap_phone2"] = phone2;
    parameters["ap_phone3"] = phone3;
    parameters["ap_phone1type"] = phonetype1;
    parameters["ap_phone2type"] = phonetype2;
    parameters["ap_phone3type"] = phonetype3;

// Opening New Record of "ap_profiling" entity , if you want to open existing record please pass recordID instead of Null in 2nd parameter



  Xrm.Utility.openEntityForm("ap_profiling", null, parameters);

No comments:

Post a Comment