1. As many of you already know that the CRM lookup field saves the GUID of the related entity. Let's have a deep view of the lookup field. When you create a relationship between two entities, one entity can reference the other entity through a lookup field. However it's not just create one attribute in the database, it means although you can only see one relationship created in CRM interface, there are some invisible attributes for internal/customizer use. Let's see an example, we know that we can reference some values from a lookup fields:
crmForm.all.regardingobjectid.DataValue[0].id; // The GUID of the lookup.
crmForm.all.regardingobjectid.DataValue[0].name; // The text value of the lookup.
crmForm.all.regardingobjectid.DataValue[0].typename; // The entity type name.
But how CRM get those values? Actually when user open a CRM record, those attributes are downloaded from CRM database to the 'containers' which can be seen from entity's customization.xml, it's a complex structure which I don't want to explain in this post. So when you create a relationship between two entities, the CRM system will create more than 2 'containers'(attributes) in the database to keep other information about the lookup field(e.g. id, typename etc).
2. Set the default value for a lookup field, let's take a look at the special lookup field again: regardingobjectid
In many cases, the regardingobjectid is default to Account, but how can we change the default value to Contact?
In the onLoad() event, you can set the default attributes by using setAttribute method which is unsupported by Microsoft, however it's a standard XML DOM method.
Let's see some examples:
crmForm.all.regardingobjectid.setAttribute("lookuptypes", "1,2"); //only show account and contact
crmForm.all.regardingobjectid.setAttribute("lookuptypeIcons", "/_imgs/ico_16_1.gif :/_imgs/ico_16_2.gif"); //set the icons
crmForm.all.regardingobjectid.setAttribute("defaulttype", "2"); //default to contact
Instead of using setAttribute method, you can also use CRM method directly:
crmForm.all.regardingobjectid.lookuptypes = "1,2";
crmForm.all.regardingobjectid.lookuptypeIcons = "/_imgs/ico_16_1.gif:/_imgs/ico_16_2.gif";
crmForm.all.regardingobjectid.defaulttype = "2";
3. If you have a look of the URL when you open a lookup window, you may see how CRM calls a lookup:
/lookupsingle.aspx?class=ActivityRegarding&objecttypes=1,2,3,4&browse=0&ShowNewButton=1&ShowPropButton=1&DefaultType=0
lookupsingle.aspx has some parameters which can be referenced by our developers, those parameters are:
Objecttypes : Entity code, e.g. Objecttypes = "1, 2" //show account and contact
DefaultType : the default lookup entity, e.g. DefaultType = "2" //default to contact
Browse : bool, 0 = show the "Look for" bar; 1 = browse model, hide the "Look for " bar.
ShowNewButton : bool, 0 = hide the "New" button; 1 = show the "New" button.
ShowPropButton : bool, 0 = hide the "Properties" button; 1 = show the "Properties" button.
In an IFRAME or a ISV solution, if you don't want users to see the 'New' Button, you can just set the URL to:
/lookupsingle.aspx?class=ActivityRegarding&objecttypes=1,2,3,4&browse=0&ShowNewButton=0&ShowPropButton=1&DefaultType=0
It's cool so far! But how about if want to hide the 'New' button in CRM?
You can't just say: crmForm.all.regardingobjectid.ShowNewButton = 0; it doesn't work. But what you can do is in the onLoad() event, use attachEvent method to attach a setadditionalparams event for the regardingobjectid. Again, those methods are all unsupported customisations, however, those are widely used in the Web development.
/*
Function: show/hide the 'New' button of lookup
bShow = 0 : hide the New Button
bShow = 1 : show the New Buton
*/
function NewButton(bShow)
{
return function()
{
crmForm.all.regardingobjectid.AddParam("ShowNewButton", bShow);
}
}
crmForm.all.regardingobjectid.attachEvent("setadditionalparams",NewButton(0));
33 comments:
Hi, thanks for this article. The only thing I am not sure about - where to add the addtional JavaScript Code?!
The Lookup View of a specific entity doesn't have an editable onLoad event ? Or did you mean to just add this snippet to the lookupsingle.aspx to set the default Item to what we want?
Thanks, yours renew
It's in entity's onLoad() event.
I am using the /_controls/lookup/lookupsingle.aspx from a custom aspx page and a custom 'lookup style' text box server control. It all works fine but i can't seem to make the Remove Value button enabled. Any ideas?
Thanks
Ant
I have tried to add the Campaign entity as a lookuptype to the regarding object of a phone call. It puts it into the list in the lookup dialog, but when I select it gives a crm error dialog and writes nothing the the event log?
Any Ideas
Looking wow gold for thrilling weapons, wow gold items and new pets? Beating wow gold the more powerful and wow gold 5000 crueler giants? Becoming the cheers of your clanbuy wow gold 5000and impressing your friends? wow gold All in http://www.masswowgold.com, We are the wow gold best alliance of the online wow goldgame players! We have: 24×7 online wow gold support;50,000+ registered users;10,000+ Paypalcheap WOW goldreputations;4 years professional service provider;We get wow gold gold from the players cheap WOW gold who do not need them any more or wow gold 5000 collect them from the direct cheap WOW gold gold farmers with wow gold lower price. Now the sell wow gold WOW gold is under big promotion. sell wow gold Registered Member will get 10% bonus.wow gold 5000 Most of the orders can be completedv sell wow gold in 3 hours. And we will give our customers the extra 5% gold if wow gold 5000 we can not complete the order in cheap WOW gold 24 hours.We deliver cheap WOW gold the gold by sell wow gold face-to-face trade wow gold 5000 in game only. Full refund will be warranted if wow gold 5000 we can not complete the cheap WOW gold orders in cheap WOW gold time.
酒店經紀PRETTY GIRL 台北酒店經紀人 ,禮服店 酒店兼差PRETTY GIRL酒店公關 酒店小姐 彩色爆米花酒店兼職,酒店工作 彩色爆米花酒店經紀, 酒店上班,酒店工作 PRETTY GIRL酒店喝酒酒店上班 彩色爆米花台北酒店酒店小姐 PRETTY GIRL酒店上班酒店打工PRETTY GIRL酒店打工酒店經紀 彩色爆米花
I am grateful to you for this great content.aöf thanks radyo dinle cool hikaye very nice ssk sorgulama only cinsellik very nice ehliyet only home free kadın last go korku jomax med olsaoy hikaye lesto go müzik dinle free only film izle love aşk only mp3 indir only radyolar lest go açıköğretim free net only filmler
Hi Jim,
Its indeed a great article. I would like to know how we could have a regardingobject lookup in a custom entity form. Basically I need to have the same functionality which a Task form has, selecting whatever lookup value.
Shamira
Your article is very good.I like it very much.
Once upon a time, there was a mouse father.He wanted to marry his daughter to the greatest person in the world.But, who was the greatest person in the world?Oh!
puma ferrari shoes
cheap nike shoesThe sun! He must be the greatest person in the world.The mouse father went to talk to the sun."Hello! Mr. Sun.
puma shoes
ferrari shoes
I know you are the greatest person in the world.Would you marry my daughter?""What? I'm not the greatest person in the world. The greatest person is the cloud.If he comes out, I’ll be covered."
nike shox nz
Ugg Boots
The mouse father went to talk to the cloud. “Hello! Mr. Cloud. I know you are the greatest person in the world. Would you marry my daughter?”
nike 360 air max
nike shox shoes
“What? I’m not the greatest person in the world. The greatest person is the wind.If he comes out, I’ll be blown away.”
cheap puma shoes
puma drift cat
The mouse father went to talk to the wind. “Hello! Mr. Wind. I know you are the greatest person in the world.Would you marry my daughter?” “What? I’m not the greatest person in the world. The greatest person is the wall. If he comes out, I’ll be stopped.”
cheap nike shox
nike air max 360
The mouse father went to talk to the wall. “Hello! Mr. Wall. I know you are the greatest person in the world. Would you marry my daughter?” “What? I’m not the greatest person in the world. The greatest person is YOU, the mouse.” “The greatest person in the world is … mouse?” “Yes, the greatest person in the world is mouse. See? If mouse comes out, I’ll be bit!”
nike air max
pumas shoes
The mouse father was very happy. He finally knew mouse was the greatest person in the world. He would marry his daughter to the handsome mouse next door.
spot season
Running in Autumn
It is time for sporting
cheap jordan shoes
澎湖民宿
團體服
團體服
團體服
團體服
生日禮物
生日禮物
減肥
減肥
飛梭雷射
皮膚科
黃金買賣
黃金價格
洗包包
Thanks for the article.
But I just want to disable the "Remove Value" button.
How can I do it?
thanks
APPLE M8403 battery
ACER aspire 3000 battery
ACER aspire 5560 battery
ACER BATBL50L6 battery
ACER travelmate 4600 battery
Dell INSPIRON 6000 battery
Dell INSPIRON 6400 Battery
Dell INSPIRON 9400 Battery
Dell INSPIRON e1505 battery
Dell INSPIRON 2500 battery
Dell INSPIRON 630m battery Dell Latitude D820 battery
Dell Latitude D620 battery
Dell xps m1210 battery
Dell inspiron xps m1710 battery
HP Pavilion ZV5000 battery
HP Pavilion DV1000 battery
HP Pavilion ZD7000 Battery
Compaq Presario 2100 battery
Compaq Presario r3000 Battery
IBM ThinkPad T40 battery
IBM 02K7018 Battery
IBM ThinkPad R60 Battery
IBM ThinkPad T60 Battery
IBM ThinkPad T43 Battery
IBM ThinkPad X40 Battery
SONY VGP-BPS2 Battery
SONY VGP-BPS2C Battery
Acer ASPIRE 1300 battery
Acer ASPIRE 1310 battery
Acer Aspire 1410 battery
Acer ASPIRE 1680 battery
ACER BTP-63D1 battery ACER BTP-43D1 battery
Acer lc.btp05.001 battery
Compaq Business Notebook NX9000 series battery
FUJITSU Lifebook C2220 battery
FUJITSU Fpcbp63 Battery
FUJITSU Fpcbp68 Battery FUJITSU Fpcbp77 Battery
FUJITSU Fpcbp78 Battery
FUJITSU Fpcbp79 Battery
Armada E700 Series battery
SONY PCGA-BP1N battery
SONY PCGA-BP2E battery
SONY PCGA-BP2NX battery
SONY PCGA-BP2S battery
SONY PCGA-BP2SA battery
SONY PCGA-BP2T battery
SONY PCGA-BP2V battery
SONY PCGA-BP4V battery
SONY PCGA-BP71 battery
SONY PCGA-BP71A battery
SONY VGP-BPL1 battery
SONY VGP-BPL2 battery
HP F4098A battery
APPLE A1078 battery
APPLE A1079 battery
APPLE A1175 battery
APPLE A1189 battery
Business Notebook NX9110 Series battery
GATEWAY NX7000 Series laptop battery
IBM 02K6821 battery
IBM 02K7054 battery
IBM 08K8195 battery
IBM 08K8218 battery IBM Thinkpad 390 Series battery
HP omnibook xe3 battery
IBM Thinkpad 390X battery
IBM ThinkPad G40 Series battery
ThinkPad G41 Series battery
Toshiba PA2487UR battery
Toshiba Satellite A105 battery
Toshiba A70 battery
PA3062U-1BAT battery
Toshiba Satellite P30 battery
Toshiba PA3084U-1BRS battery
Toshiba PA3098U battery
PA3107U-1BAS battery
PA3107U-1BRS battery
PA3166U-1BRS battery
PA3176U-1BAS batteryPanasonic CGR-S006E battery Panasonic CGA-S006 battery Panasonic Lumix DMC-FZ8 battery OLYMPUS LI-40B battery <a
mcqueen shoes
alexander mcqueen heels
Alexander McQueen Store
Jimmy Choo sale
Replica jimmy choo shoes
manolo blahnik online store
manolo shoes
manolo blahnik sale
replica christian louboutin shoes
discount christian louboutin shoes
alexander mcqueen shoes
jimmy choo outlet
jimmy choos
jimmy shoes
Manolo Blahnik Shoes
christian shoes
Jimmy Choo Embossed leather sandals
Jimmy Choo Zero metallic-leather sandals
Christian Louboutin Alta Perla Strass 100 sandals
Christian Louboutin - Declic leather pumps
Hi Jim! I like your posts. Im facing a new problem.. I want to aagg a new object types to look up, beside Account, Contact, User and Leads. I wanna add a new Entity I created.. Can I do that? how can I do it?
Thanks Jim..
Last month, Sonoma Partners and Microsoft had an very useful article for CRM developers: Setting Up Your Development Environment, I have abstract it into Chinese version. In this post, I’d like to give my idea about how to build up a handy Dynamics CRM…
http://www.refurbishedusedlaptop.ca/
Hello, your blog is really good, I like it very much!By the way, if you like nike shoes you can come here to have a look!
Three icons converge in Nike Shoes Us, a bold design that combines the best style and cushioning features from legends of Nike Air Max Shoes. With the lacing system of the '95, "Nike air max 2011the silhouette of the '97, and the full-length Max Air inspired by the Nike Air Max 2009, this shoe delivers unbeatable comfort 24 hours a day, seven days a week.
Nike Air Max 1
Air Max Griffey 1
Nike Air Max 180
Nike Air Max 2009
Nike Air Max 2010
Nike Air Max 24 7
Nike Air Max 87
Nike Air Max 2011
Nike Air Max 91
Nike Air Max BW
Nike Air Max Plus TN
Nike Air Max LTD
Nike Air Max Boots
Nike Air Max Presto
Nike Air Max Skyline
Nike Air Max Turbulence
Nike Air Max Fitsole
Nike Air Max Goadome
Nike Air Max Zenyth
Nike Air Max Wildwood Supreme
Nike Air Max Zoom Kobe
Nike Air Max Shoes.
Christian Louboutin Outlet Online shoe store is up for many years.A man who wants to play its expertise, it must fit the social environment needs. If you need from the social environment, their expertise will lose value. Therefore, we have according to community needs, determine their own actions, better to show themselves. Christian Louboutin Outlet Online shoes wear can make you look more beautiful, more attractive feet.
Nice post! Thanks for sharing!
Comprare Cialis Generico
Really impressed! Everything is very open and very clear explanation of issues. Your website is very useful. Thanks for sharing. Looking forward to more!
Anime forums
Naruto forums
Manga forums
Luffy forums
Bleach forums
Naruto Shippuden
Naruto Shippuden forums
Cheap Web Design Company India
Web hosting reviews
Web hosting Tips
Advertising network reviews
I wanted to thank you for this great read!! I definitely enjoyed every little bit of it, I have you bookmarked to check out all the new stuff you post.I am a china tour lover,You can learn more: travel to Beijing | Guilin Tourist Attractions | What to See in Guilin
I really appreciate spending some time to talk about that, I believe firmly regarding this and so really enjoy understanding more about this kind of subject.This is also a very good post which I really enjoyed reading. It is not everyday that I have the possibility to see something like this. CRM Software || MLM Software in Mumbai || ERP Software || System Software in Mumbai
học kế toán thực hành cấp tốc
học kế toán thực hành cấp tốc
học kế toán thực hành tại cầu giấy
học kế toán thực hành tại thanh xuân
]học kế toán thực hành tại hà đông
học kế toán thực hành tại long biên
học kế toán thực hành tại long biên
học kế toán thực hành tại hải phòng
học kế toán thực hành tại bắc ninh
học kế toán thực hành tại tphcm
học kế toán thực hành tại quận 3
học kế toán thực hành tại hải phòng
học kế toán thực hành tại bắc ninh
học kế toán thực hành tại bình dương
học kế toán thực hành tại biên hòa
học kế toán thực hành tại vinh
học kế toán thực hành tại vinh
học kế toán thực hành tại huế
học kế toán thực hành tại đà nẵng
học kế toán thực hành tại đà nẵng
học kế toán thực hành tại đà nẵng
học kế toán thực hành tại hải dương
học kế toán thực hành tại hưng yên
học chứng chỉ kế toán
học kế toán ở đâu tốt
Thanks for your extraordinary blog. Your idea for this was so brilliant. This would provide people with an excellent tally resource from someone who has experienced such issues. You would be coming at the subject from a different angle and people would appreciate your honesty and frankness. Good luck for your next blog!
Tally ERP 9 Training
tally classes
Tally Training institute in Chennai
Tally course in Chennai
Thanks for sharing the Amazing Post. It shows your in-depth knowledge on the subject. Keep
updating.
Salesforce Training | Online Course | Certification in chennai | Salesforce Training | Online Course | Certification in bangalore | Salesforce Training | Online Course | Certification in hyderabad | Salesforce Training | Online Course | Certification in pune
Thank you very much for the information you shared, it’s all I’ve been looking for. The content is more related.
Java Training in Chennai
Java Course in Chennai
Wonderful sharing..thanks a lot for writing this article.
DevOps Training in Chennai
DevOps Training in Chennai
Thanks for sharing such a amazing article, it was really useful and I would like to thank you for this article, am very much interested
to learn new thing like this. Keep posting like this valuable information.
Data Science Training In Chennai
Data Science Course In Chennai
Hi I am from Join Pak Navy I and I really like your work thanks for this information and keep it up you are doing good.
Thanks for posting the best information and the blog is very helpful. BEST TRAINING INSTITUTE FOR AWS
Really an informational blog. Useful content. Keep sharing more blogs with us.
Online UI Development Training in Hyderabad
Online Mean Stack Development Training in Hyderabad
https://pfskillbuilders.com/copy-writing-course-kolkata
Do you want to play with words and set a fun and bright future in the marketing industry? Look no further! Introducing our groundbreaking Copywriting Mastery Course, designed to transform your comments into compelling stories that captivate, convert, and are compelling. Learn copywriting courses in Kolkata from PfSkillBuilders and enable yourself to dominate the copywriting field.
Join our Copywriting Mastery Course now and receive:
Instant Access to All Modules
Downloadable Resources and Cheat Sheets
Course Completion Certificate
Access to Our Vibrant Copywriting Community
PFSkillBuilders provides a fun yet professional learning environment and makes you market ready. So Wait no more and enroll in a copywriting course to earn a six-figure salary!
Post a Comment