locked
crm2013 - how to change (reload) form, based on value of field RRS feed

All replies

  • no Solutions?
    Wednesday, November 20, 2013 8:01 AM
  • Hi,

    If I understand correctly (please correct me in case of any change in the steps), you need to

    1. Open a record.
    2. Load a form (out of several custom forms) which depends on a field present on the forms.
    3. Read the value of that field.
    4. Depending on the value of field, you need to navigate to the specific Custom form.


    In CRM 2013, when you navigate to a specific the form, the form load automatically happens.

    For example - onchange of the a Preferred Method of Contact field / On Form Load of the Contact form, if the following code is executed:

    function selectmyform() {
       //Example - preferredcontactmethodcode is a field on the Contact form
       var pMethod =  Xrm.Page.getAttribute("preferredcontactmethodcode").getText();
       
       var item = Xrm.Page.ui.formSelector.getCurrentItem();
       if(pMethod == "Email")
       {
          Xrm.Page.ui.formSelector.items.get()[1].navigate(); 
       }
       else
       {
          alert(pMethod)
       }
    }

    Here I'm selecting the "Information" form with the index. As soon as the navigation occurs, the form is reloaded.

    Let me know your inputs so as to proceed with the resolution.

    Thanks & Regards,


    Anubhav Bajpai

    Wednesday, November 20, 2013 9:22 AM