Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Post image

Posted on by 5,005

I have been asked in interview

I said in an interview

Pre image is used to check before value and Post image is used to check after value . I have been asked  if system is having the value why post image is required ?

Why actually we need post image

*This post is locked for comments

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Post image

    Just to add on " if system is having the value why post image is required " if you do not use post image then you need to do a retrieve to get the system value by doing another call which is not a good practice considering you can get the system value in post image.

    Hope this helps.

  • Verified answer
    Dynamics365 Rocker Profile Picture
    Dynamics365 Rocker 7,755 on at
    RE: Post image

    You have a plugin that execute on "Name" field of account entity but some one updated name and post code then you will not get value of post code in target as your plugin execute for name only. In this case you need post image. Post image will have post code.

  • Suggested answer
    Kalpavruksh D365 CoE Profile Picture
    Kalpavruksh D365 CoE 2,545 on at
    RE: Post image

    Hi,

    Current Context will contain the fields that are changed by the user. Use PostImage to retrieve additional fields apart from the context fields(updated). 

    Example:  User updated account name but you need information from the owner field. 

    Current Context: Name

    PostImage: Owner

    Please let us know, in case of any further query.

  • Suggested answer
    Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: Post image

    Hi

    Plugins allows us to write custom code to implement custom business logic, this could be just validation, or changing data or any type of operation really.

    Now, plugin only triggers on Events (Messages), for example update or delete or create or other

    If a Plugin triggers lets say on Update of a field, and lets assume in your plugin code you want to check what was the previous value and whats the new value.

    You can only get to the previous value in plugin by asking CRM to give you a copy of the record just before the change was made - This is PreImage

    You also want to know whats the new value, for this you are getting the Post Image - The post image is copy of the record after the change but it is not yet fully committed to database. if the plugin fails for some reason, any change in the post image will be lost.

    In short, Pre and Post images are just copies of data before change and data after the change. And Post image will only become permanent if the plugin execution completed with no error. If there was an exception in plugin execution, the entire transaction will be rolled back.

  • Verified answer
    Pawar Pravin  Profile Picture
    Pawar Pravin 5,227 on at
    RE: Post image

    Hi Sandeep,

    Let me explain one scenario here.

    Suppose my plugin is on post update of account record (Email address is update and trigger point for the plugin). Now I want to check previous email as well as new email and need to send email to both email Id's.

    Pre-Image will give me previous email Id and Post-Image will give me new email Id.

    Some my concern is with email id want some information from account which is I'm updating inside coding. Let say I'm updating Contact number inside coding. In this case I need to post image to get rest of the values which is updated in account.

    Please refer following blog for more reference:

    community.dynamics.com/.../pre-image-and-post-image-in-dynamics-crm

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans