Options we have to access fields that are not included in the context.
- Obtain a reference to Organisation Service within your plugin, and then use a Retrieve request to return the fields you need from the plugin. As the context will always contain the GUID for the record that has changed, this is generally the most common way you will see this done.
- Utilise either a Pre or Post Entity Image of the record, which contains the attributes that you need to access.
Previously we would be using the First option for any kind of operations.Recently though, I have been evaluating Entity Images more and more, and have begun to actively use them as part of my plugins. Entity Images are, essentially, snapshots of the CRM record that are stored on the platform either before the database operation has completed or straight after – you can decide which one you want to use, depending on what your plugin is doing. They are configured as part of deploying your plugin to your target CRM instance, and the steps involved are actually quite simple – I think it’s generally the case that they are not well-understood or utilised by developers who are learning about CRM for the first time.
So why should you go to the extra effort to use them within your plugins?
As alluded to above, using Pre Entity Images means you can get a snapshot of your CRM data before the data was changed. This may prove to be particularly invaluable in cases where you need to perform a before/after comparison on a particular field, and then execute a specific action either way. The only non-entity image way of doing this within CRM would be via hidden field that stores the current value of your field in question, which is referenced and updated once your business logic has completed. A slightly inelegant solution, and one that is questionable, given that we can utilise Entity Images instead. Having ready access to the attributes which may not necessarily be exposed to the plugin when it is executed is particularly invaluable, given that this avoids a scenario where you would have to go down option 1). Disadvantages of this approach is the potential for unnecessary delays in your plugin completing and problems with your CRM instance as a whole, if your CRM’s web services are already accessed to breaking point.
In these cases, we go with plugin images. That’s all for today.. would be sharing code related stuff about using plugin images in my next blog post..
Cheers,
PMDY
Youre so cool! I dont suppose Ive read something like this before. So nice to seek out somebody with some original ideas on this subject. realy thank you for starting this up. this web site is something that’s wanted on the net, someone with slightly originality. useful job for bringing one thing new to the web!
LikeLike
I like what you guys are up also. Such clever work and reporting! Keep up the superb works guys I’ve incorporated you guys to my blogroll. I think it’ll improve the value of my website 🙂
LikeLike
I’ve been browsing online more than three hours today, yet I by no means discovered any interesting article like yours. It’s pretty price enough for me. In my opinion, if all site owners and bloggers made excellent content material as you probably did, the net might be much more helpful than ever before.
LikeLike
I have been examinating out some of your posts and i must say pretty good stuff. I will surely bookmark your site.
LikeLike
Thank you..
LikeLike