lookuptypenames = ‘contact:2:Contact,systemuser:8:User’;
lookuptypes = ‘2,8’;
if (crmForm.all.to != null) {
crmForm.all.to.setAttribute(“defaulttype”, “2”);
crmForm.all.to.setAttribute(“lookuptypes”, lookuptypes);
crmForm.all.to.setAttribute(“lookuptypenames”, lookuptypenames);
crmForm.all.to.setAttribute(“lookuptypeIcons”, lookuptypeIcons);
Xrm.Page.getControl(“to”).setDefaultView(“A2D479C5-53E3-4C69-ADDD-802327E67A0D”); //GUId for default View
}
var toLookUp = $(“img[attrName=’to’]”);
var lookuptypeIcons = ‘/_imgs/ico_16_2.gif?ver=828891367:/_imgs/ico_16_8.gif??ver=828891367’;
var lookuptypenames = ‘contact:2:Contact,systemuser:8:User’;
lookuptypes = ‘2,8’;
if (toLookUp.length > 0) {
toLookUp[0].setAttribute(“lookuptypenames”, “contact:2:Individual,systemuser:8:User”);
toLookUp[0].setAttribute(“lookuptypes”, “2,8”);
toLookUp[0].setAttribute(“lookuptypeIcons”, lookuptypeIcons);
toLookUp[0].setAttribute(“createpermissiondictionary”, “contact:true,systemuser:true”);
toLookUp[0].setAttribute(“DefaultViewId”, “A2D479C5-53E3-4C69-ADDD-802327E67A0D”);
toLookUp[0].setAttribute(“defaulttype”, 2);
}
});
—
Happy CRM’img
Gopinath
Thanks! It helped me!
LikeLike
I am glad it helped you.
LikeLike
Hi….I wrote this code function Test(){alert(\”hello\”);$(\”#to\”).focus(function () {var theLookupTO = $(\”img[attrName='to']\”);alert(theLookupTO);if(theLookupTO.length > 0){theLookupTO[0].setAttribute(\”lookuptypenames\”, \”systemuser:8:User\”);theLookupTO[0].setAttribute(\”lookuptypes\”, \”8\”);theLookupTO[0].setAttribute(\”lookuptyprIcons\”, \”/_img/ico_16_8.gif?ver=828891367\”);theLookupTO[0].setAttribute(\”createpermissiondictionary\”, \”systemuser:true\”);theLookupTO[0].setAttribute(\”DefaultViewID\”, \”{A2D479C5-53E3-4C69-ADDD-802327E67A0D}\”);theLookupTO[0].setAttribute(\”defaulttype\”,\”8\”);}});} and then called the function Test.But it did not work. can you please help if anything else to be done to write a jQuery
LikeLike
Hi Gopinath,i tried to use your code , but couldnt achieve it. can help ??
LikeLike
Hi gopi,i tried the same but couldnt achieve this. do we need to add any jquery reference for this??
LikeLike