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..
↧