Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
problem in window.openr()

Unanswered problem in window.openr()

  • 05 Mei 2012 19:05
     
     

    hi

    i work with crm4, when i use this code in onloade of second form, fields doesnt fill with primform fields

    if (crmForm.FormType == 1)
    {
     // Check to confirm that the window.opener is present.
     if (window.opener)
     {
      // Get the values of the parent form.
      var oParentCrmForm = window.opener.document.all.crmForm;
       
      // Check that you obtained the values of the parent form and
      // that the parent form is an account.
      if (oParentCrmForm && oParentCrmForm.ObjectTypeCode == 1)
      {
       // Get the name of the account.
       var sAccountName = oParentCrmForm.all.name.DataValue;
           
       // Set the default value of the task subject to
       // include a reference to the related account.
       crmForm.all.parent_name.DataValue = "account: " + sAccountName;
      }
     }
    }

Semua Balasan

  • 05 Mei 2012 22:16
     
      Memiliki Kode

    If it's just the Account Name you need, you could just get the name from the Regarding Lookup reference on the Task:

    if (crmForm.FormType == 1) {
        var regardingObject = crmForm.all.regardingobjectid.DataValue;
        var regardingType = regardingObject[0].typename;
    
        // Check to confirm that it is regarding an account
        if (regardingType == "account") {
            // Get the name of the account.
            var sAccountName = regardingObject[0].name;
    
            // Set the default value of the task subject to
            // include a reference to the related account.
            crmForm.all.parent_name.DataValue = "account: " + sAccountName;
        }
    }

    Here's more information about getting the lookup data:
    http://www.magnetism.co.nz/blog/nathan/10-05-28/Retrieving_Data_from_Lookup_Fields.aspx

    Hope that helps!

    -Paul