locked
Post Image is not getting populated RRS feed

  • Question

  • Hello,

    I created a plugin for the contact entity where I need retreive an attribute value before and after an update.

    I did register a step for "Post Operation" and register on that step 2 images (one is pre image and the other is post image).

    The pre image is getting populated but the post image is not.

    Is the images registration I am doing above is correct? or should I register  pre image and post image in one step instead of registering 2 images as I am doing?

    Please advise.

    Thanks.

    Sunday, July 8, 2012 2:13 PM

Answers

  • hi,

    is "owninguser" is string field which contains guidID....?

    if it is lokk uo use below code

    preOwningUser=((EntityReference)preMessageImage.Attributes["owninguser"]).Id;


    Please don't forget to Vote and marked as answer If this post answers your question or was helpful, please click "Mark As Answer" on the post and "Mark as Helpful" Be wise

    • Proposed as answer by san Sanz Monday, July 9, 2012 7:08 AM
    • Marked as answer by Nick2020 Monday, July 9, 2012 1:12 PM
    Monday, July 9, 2012 6:40 AM
  • which message are you trying this on? For Create Message the Pre-Image would be empty and you will not find the values for any attributes.

    Instead of "owninguser" can you try with "Owner" attribute. That would return an entity reference and you can identify from there if it is a system user or a Team.

    To avoid the error check if attribute exists in collection before accessing it.

    if (preMessagelmage.Attributes.Contains("owner"))

    {

    //read owner value

    }

    HTH

    Sam


    Dynamics CRM MVP | Inogic | http://inogic.blogspot.com| news at inogic dot com

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    • Marked as answer by Nick2020 Monday, July 9, 2012 1:12 PM
    Monday, July 9, 2012 12:40 PM

All replies

  • http://inogic.blogspot.de/2010/07/pre-image-post-image-explained.html

    http://deepakexploring.wordpress.com/2011/02/04/preentityimages-and-postentityimages-in-crm-5-0-2011/

    should help you


    Carsten Groth http://carstengroth.wordpress.com Microsoft Dynamics Certified Technology Specialist CRM Online 30 Tage kostenfrei testen – http://crm.dynamics.com/de-de/trial-overview

    • Marked as answer by Nick2020 Monday, July 9, 2012 1:12 PM
    • Unmarked as answer by Nick2020 Monday, July 9, 2012 1:12 PM
    Sunday, July 8, 2012 5:46 PM
  • Thank you Carsten!

    When using image to retrieve an attribute value for a guid, I am using the following:

    preOwningUser = new Guid(preMessagelmage.Attributes["owninguser"].ToString());

    The above line is causing an exception

    Then I tried:

    preOwningUser =

    Guid.Parse(preMessagelmage.Attributes["owninguser"].ToString());

    I got the following error: error Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)                                                                                                           

    How I can convert an object to guid since preMessagelmage.Attributes["owninguser"] returns an obj

    Sunday, July 8, 2012 10:00 PM
  • hi,

    is "owninguser" is string field which contains guidID....?

    if it is lokk uo use below code

    preOwningUser=((EntityReference)preMessageImage.Attributes["owninguser"]).Id;


    Please don't forget to Vote and marked as answer If this post answers your question or was helpful, please click "Mark As Answer" on the post and "Mark as Helpful" Be wise

    • Proposed as answer by san Sanz Monday, July 9, 2012 7:08 AM
    • Marked as answer by Nick2020 Monday, July 9, 2012 1:12 PM
    Monday, July 9, 2012 6:40 AM
  • which message are you trying this on? For Create Message the Pre-Image would be empty and you will not find the values for any attributes.

    Instead of "owninguser" can you try with "Owner" attribute. That would return an entity reference and you can identify from there if it is a system user or a Team.

    To avoid the error check if attribute exists in collection before accessing it.

    if (preMessagelmage.Attributes.Contains("owner"))

    {

    //read owner value

    }

    HTH

    Sam


    Dynamics CRM MVP | Inogic | http://inogic.blogspot.com| news at inogic dot com

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    • Marked as answer by Nick2020 Monday, July 9, 2012 1:12 PM
    Monday, July 9, 2012 12:40 PM
  • Thank you so much anwar and Sam.
    Monday, July 9, 2012 1:12 PM