Answered by:
Plugin - PostImage Does Not Contain Updated Value

Question
-
I have created a generic plugin that we are using to generate update and create messages to our biztalk server for synchronization to various downstream environments. The plugin registered for Update and Create messages in the Post Stage of the Child Pipeline, for entities we are interested in. I have registered a Post Image for this step and just serialize the results as necessary.
This is working great except for when the address is updated on the account entity. In this instance the Post Image still contains the old address. I see that the address portions have their own GUIDs which would lead me to believe they are possibly their own system entities behind the scenes, but that is just a guess.
Any thoughts on what I will need to do to get the updated addresses would be appreciated. I am using one plugin for all entities so I really want to keep this as generic as possible.
Chris Wigley MCAD\MCPDFriday, June 4, 2010 9:07 PM
Answers
-
You can easily get values from InputParameters, why use postImage?
InputParameters always contains the value which are updated on the entity form.
Input Parameters
The InputParameters property bag contains all the information specified in the Request class whose message caused the plug-in to execute. The keys used to obtain values from the property bag are named according to the name of the Request class instance properties
Muhammad Ali Khan
http://malikhan.wordpress.com- Proposed as answer by Muhammad Ali Khan Saturday, June 12, 2010 5:51 AM
- Marked as answer by DavidJennawayMVP, Moderator Wednesday, July 21, 2010 3:58 PM
Saturday, June 12, 2010 5:50 AM
All replies
-
Yes the entity used for address is "customeraddress".
so you have to write a plugin on the update event of the customeraddress.
Muhammad Ali Khan
http://malikhan.wordpress.comSaturday, June 5, 2010 5:39 AM -
Muhammad,
This definately makes sense, however I cannot get seem to get the plugin registered correctly. I can't even get it to recognize the event and step into the code. The same plugin is working for all of the other entities.
What should this registration look like to get it to fire if I want the customeraddress update message when account is updated.
Chris Wigley MCAD\MCPDWednesday, June 9, 2010 1:08 AM -
Update... The only way I have been able to get this to work is by sticking to the account update. For just address1 and address2 I can't find any way to make it trigger an CustomerAddress update. To work around this, I am reading everything from my post image except address1 and address2 which I am reading from input parameters.
Any thoughts on the validity of handling it this way are highly welcomed as this solution doesn't really set well with me, only because I don't understand the mechanics behind the differences of the address1 and address2 fields as opposed to everything else that uses customer address for address information.
Chris Wigley MCAD\MCPDFriday, June 11, 2010 11:18 AM -
I think for address1 & address 2 you have to use the account update plugin and for the rest of addresses you have to use the customeraddress plugin.
Reason: i think this is because there is address1_line & address2_line(etc) fields are there on the account entity but there are no fields for address3_line (etc) so if you update address1 & address 2 you can get hold of htem using the account update but not the other addresses which are linked to account using the customeraddress(entity) relationship.
Muhammad Ali Khan
http://malikhan.wordpress.comFriday, June 11, 2010 12:56 PM -
Yes that is exactly what I have now. The fun part is that the post image of an account update, if address1 or address2 have changed, does not contain the current values. To work around, I am getting those from the input parameters.
I appreciate your input on this, very frustrating scenario.
Chris Wigley MCAD\MCPDFriday, June 11, 2010 9:50 PM -
You can easily get values from InputParameters, why use postImage?
InputParameters always contains the value which are updated on the entity form.
Input Parameters
The InputParameters property bag contains all the information specified in the Request class whose message caused the plug-in to execute. The keys used to obtain values from the property bag are named according to the name of the Request class instance properties
Muhammad Ali Khan
http://malikhan.wordpress.com- Proposed as answer by Muhammad Ali Khan Saturday, June 12, 2010 5:51 AM
- Marked as answer by DavidJennawayMVP, Moderator Wednesday, July 21, 2010 3:58 PM
Saturday, June 12, 2010 5:50 AM