I used
document.getElementById("customerid").setAttribute("defaulttype", "2");
document.getElementById("customerid").setAttribute("lookuptype", "2");
Xrm.Page.getControl("customerid").setDefaultView("{A9AF0AB8-xxxx-xxxx-xxxx-C6281FED7FAB}");
in Form_onchange(), and it gives me this error:
Object doesn’t support this property or method”.
If I close the popup window, the program actually works fine.
What might be the problem?
P.S. I’m running IE9 and the error message didn’t specify which method is not supported.
“{A9AF0AB8-xxxx-xxxx-xxxx-C6281FED7FAB}” isn’t a valid GUID. Make sure to use the exact GUID of the View.
Ok, I’ve never seen anyone X out the GUID…
Anyhow, take out line 2 and see if that works. I checked back on some of my code and I have lines 1 & 3.
Also, your lookup needs to already be able to switch from accounts to contacts (type code 1 -> 2) within the interface (as a user not via javascript).