locked
Could not be able to get target entity attribute values on post update plugin. RRS feed

  • Question

  • Hello All,

                     I'm trying to get attribute values of target entity in post update stage of plugin using "XXX.GetAttributeValue<string>("mcg_name")"  .But It seems that the attribute values are not getting retrieved using the above method.

                   Is there any way to get target entity attribute value in post update plugin?


    Prashant Wani ,Software Engineer-II,Infinx Services Pvt.Ltd.

    Friday, January 24, 2014 10:04 AM

All replies

  • you will get only value of fields which are updated means whose value change while updating.

    and you can use

    if(Entity.attributes.contains("attName"))

    {

    string value= Entity.attributes["attName"].toString();

    }

    or you can use reterive or fetch query to get all required columns .


    Hope this helps. ----------------------------------------------------------------------- Santosh Bhagat If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"

    Friday, January 24, 2014 10:43 AM
  • Hi Prashant,

    You can try configuring a PostImage to your Plugin step and access the required attribute values from the PostImage entity.

    if (context.PostEntityImages.Contains(“PostImage”) && context.PostEntityImages["PostImage"] is Entity)
    {
    	entity = (Entity)context.PostEntityImages["PostImage"];
    	....
    

    Here are some blogs with more details on how to configure and sample codes

    http://sumedha8.blogspot.com.au/2012/10/sample-plug-in-compare-pre-and-post.html

    http://www.magnetismsolutions.com/blog/zhenyu/12-01-11/Creating_an_Audit_Plugin_in_Dynamics_CRM_2011.aspx


    Eric UNG [Senior Analyst Programmer :: Sydney, Australia]

    Friday, January 24, 2014 10:49 AM