Answered by:
Plugin: Which Field Was Updated

Question
-
Assume each time an address in contact/lead/account is created/updated the address is checked by a server-side plugin. If you would use an external source you might have to pay for such a service so you only want to run it when indeed an address change has happened. How do you determine if one of the address fields has changed rather then some other field in the contact/lead/account? Thanks.
Monday, February 8, 2010 7:10 AM
Answers
-
You can check what fields was changed:
DynamicEntity entity = (DynamicEntity)context.InputParameters["Target"];
if (entity.Properties.Contains(<property name>))//if field was changed - it would be in the properties of entity
{
//here is your logic
}
Truth is opened the prepared mind
My blog (english)
Мой блог (русскоязычный)- Proposed as answer by RhettClintonMVP, Moderator Tuesday, February 9, 2010 9:01 PM
- Marked as answer by DavidJennawayMVP, Moderator Thursday, March 4, 2010 11:55 PM
Monday, February 8, 2010 7:41 AMModerator -
Write a plugin on the contact/account and while doing the plugin registrion in the plugin registration tool, define hte filtering attributes on all the required address attriubtes like address1_line, address1_city etc. this way the plugin will fire only once the address changes.
I think you have too write a plugin on the customaddress entity as well. since this entity is used in "More Addresses" of the account/contact entity.- Marked as answer by DavidJennawayMVP, Moderator Thursday, March 4, 2010 11:55 PM
Monday, February 8, 2010 7:42 AM
All replies
-
You can check what fields was changed:
DynamicEntity entity = (DynamicEntity)context.InputParameters["Target"];
if (entity.Properties.Contains(<property name>))//if field was changed - it would be in the properties of entity
{
//here is your logic
}
Truth is opened the prepared mind
My blog (english)
Мой блог (русскоязычный)- Proposed as answer by RhettClintonMVP, Moderator Tuesday, February 9, 2010 9:01 PM
- Marked as answer by DavidJennawayMVP, Moderator Thursday, March 4, 2010 11:55 PM
Monday, February 8, 2010 7:41 AMModerator -
Write a plugin on the contact/account and while doing the plugin registrion in the plugin registration tool, define hte filtering attributes on all the required address attriubtes like address1_line, address1_city etc. this way the plugin will fire only once the address changes.
I think you have too write a plugin on the customaddress entity as well. since this entity is used in "More Addresses" of the account/contact entity.- Marked as answer by DavidJennawayMVP, Moderator Thursday, March 4, 2010 11:55 PM
Monday, February 8, 2010 7:42 AM