- Via the Target InputParameter
- Via an Image Entity registered on the step
- Via a Retrieve request in the plug-in code
These do not always work in the same way, as follows:
Availability of the data by stage
The general rules are:
- InputParameter is available in all stages. It can be modified in the pre-stage, but changing it in the post-stage will have no effect
- A PostImage Entity is available in the post-stage, and a PreImage Entity in the pre-stage only
- If using a Retrieve in the plug-in, then the data returned depends on the stage. In the pre-stage, you will see the data before the modification, whereas in the post-stage you see the data after the modification
- Some Image Entities are not relevant for some messages - e.g. there is no PreImage for a Create message, and no PostImage for a Delete message
Data in the Name attribute
If the message is updating CRM (e.g. a Create or Update message) then the InputParameter only contains the minimum information that needs to be saved to CRM. A consequence of this is that the name attribute of any of the following data types is null:
- Lookup
- Owner
- Customer
- Picklist
- Boolean
So, if your code needs to access the name, then you cannot rely on the InputParameter, and have to use either the Image Entity or a Retrieve to get the data.
My preference is to use an Image Entity, mostly as this reduces the code I have to write. The CRM SDK also suggests that this is more efficient, though I've not done any thorough performance testing on this to determine if this is relevant.
2 comments:
Clear, concise and useful. Thanks for sharing.
Simon Jackson
Is it possible to use the preImage/postImage in a custom workflow?
Post a Comment