Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Highlighted
Copper Super Contributor
Posts: 172
Registered: ‎07-06-2010

Address entity properties are empty?

[ Edited ]

I am trying to wire up an assembly to validate zip code syntax for Canadian addresses. 

 

I have started by overriding OnCreate, OnBeforeUpdate, and OnBeforeInsert. But it looks like OnCreate is being fired at strange times. 

 

In my case, if I pull up an Account, and attempt to edit an already existing Address, the event is fired and I get an Object Reference exception, and all the Address' properties are empty - even if I put my custom event code in PreExecute.

 

If I remove OnCreate, it saves, but it also doesn't fire OnBeforeUpdate and OnBeforeInsert; none of the code is executed in either event. 

 

I am following the steps outlined here: 

http://customerfx.com/pages/crmdeveloper/2010/05/18/using-an-external-assembly-for-entity-events-and...

 

Is there something I am missing? I suppose I can try on the same Account and Contact events but that means duplication of code when what I really want to do is check against the Address entity regardless of the object associated with it.

Highlighted
Copper Super Contributor
Posts: 172
Registered: ‎07-06-2010

Re: Address entity properties are empty?

Hopefully someone can provide some feedback. I've wired up these events to the Account and I can't get any of them to fire.
Highlighted
Bronze Super Contributor
Posts: 152
Registered: ‎02-01-2011

Re: Address entity properties are empty?

1. sounds like you're creating an Address entity in your external assembly, rather than getting a reference to it? Which is why all the fields are blank - it's just giving you the shell to fill.

2. the events should be on the address entity, not the account entity; only the address will fire the onBeforeInsert/onBeforeUpdate (the Account entity does not get updated, the Address has the AccountId in a M:1 relationship so the Account entity is unaware of the record change.)

Andy Freeman
TrellisPoint, LLC