locked
Showing assoicated primary contact in a Account form using IFRAME RRS feed

  • Question

  • Hi All,

    How to show primary contact in a account form using IFRAME?  I used the below code but how to bring in primary contacts? Please let me know

    var navContacts;

    navContacts = document.all.navContacts;

    if (navContacts != null)

    {

    navContacts.style.display = "none";

    document.all.IFRAME_Contacts.src="/sfa/accts/areas.aspx?oId=" + crmForm.ObjectId + "&oType=2&security=852023&tabSet=areaContacts";

    }

     

     

    Wednesday, April 28, 2010 12:26 AM

Answers

  • Try this code:

     

    if ((crmForm.all.primarycontactid.DataValue != undefined) && (crmForm.all.primarycontactid.DataValue != null))
    {
    var contactid = crmForm.all.primarycontactid.DataValue[0].id;

    crmForm.all.IFRAME_contacts.src = "http://devsystem:5555/DEVSYSTEM/sfa/conts/edit.aspx?id=" + contactid;
    }

     

    Be careful. The name of the iFrame is case-sensitive, you if your iFrame is called "IFRAME_Contacts", you need to change the code to upper case.

    It's not pretty, but it works on my dev-machine.

    • Marked as answer by Jim Glass Jr Friday, April 30, 2010 4:34 PM
    Thursday, April 29, 2010 7:49 AM
  •  

    You shoul also consider to call this function in the onchange of the primary contact, so that if the user is changing the primary Lookup Field the IFrame would also refreshed.

     

    Bye Matthias

    • Marked as answer by Jim Glass Jr Friday, April 30, 2010 4:34 PM
    Thursday, April 29, 2010 1:18 PM

All replies

  • The primary contact is inside a lookup on the account form (primarycontactid).

    So, in order to do what you want to do, I'd write this kind of code:

     

    var contactid = crmForm.all.primarycontactid.DataValue[0].id;

    crmForm.all.IFRAME_Contacts.src = "http://<<crm-url>>/sfa/conts/edit.aspx?id=" + contactid;

     

    That should do it.

    Wednesday, April 28, 2010 12:45 PM
  • Hi

     

    Thanks for the reply, where do i need to define this? In the Onload Event?

    Wednesday, April 28, 2010 4:23 PM
  • Hi All,

    I have tested in my environment and it is not working.  I had put the code in onload event.

    Thanks

    Vinod

    Wednesday, April 28, 2010 10:42 PM
  • Try this code:

     

    if ((crmForm.all.primarycontactid.DataValue != undefined) && (crmForm.all.primarycontactid.DataValue != null))
    {
    var contactid = crmForm.all.primarycontactid.DataValue[0].id;

    crmForm.all.IFRAME_contacts.src = "http://devsystem:5555/DEVSYSTEM/sfa/conts/edit.aspx?id=" + contactid;
    }

     

    Be careful. The name of the iFrame is case-sensitive, you if your iFrame is called "IFRAME_Contacts", you need to change the code to upper case.

    It's not pretty, but it works on my dev-machine.

    • Marked as answer by Jim Glass Jr Friday, April 30, 2010 4:34 PM
    Thursday, April 29, 2010 7:49 AM
  •  

    You shoul also consider to call this function in the onchange of the primary contact, so that if the user is changing the primary Lookup Field the IFrame would also refreshed.

     

    Bye Matthias

    • Marked as answer by Jim Glass Jr Friday, April 30, 2010 4:34 PM
    Thursday, April 29, 2010 1:18 PM