Quantcast
Channel: Microsoft Dynamics CRM
Viewing all articles
Browse latest Browse all 154803

Forum Post: RE: Populate a Lookup field on Account creation using a Plugin

$
0
0
Hi.. As you are registering plugin on Account, pre-validation stage, you don't need to use service.update Also you need to add attribute into attribute collection entity.Attributes["aa_countynumberid"] = new EntityReference("aa_county", countyId.Id); entity.Attributes["aa_countynumberid"] = new EntityReference("aa_region", regionId.Id); change it to if(entity.Attributes.contactis("aa_countynumberid")) entity.Attributes["aa_countynumberid"] = new EntityReference("aa_county", countyId.Id); else entity.Attributes.Add("aa_countynumberid", new EntityReference("aa_county", countyId.Id)); if(entity.Attributes.contactis(" aa_countynumberid ")) entity.Attributes[" aa_countynumberid "] = new EntityReference("aa_region", regionId.Id); else entity.Attributes.Add(" aa_countynumberid ", new EntityReference("aa_region", regionId.Id)); change it to region attribute instead of county number. hope this will help..

Viewing all articles
Browse latest Browse all 154803

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>