locked
Assigning values to dynamic entity in plugins RRS feed

  • Question

  • Hi ,

    i am trying to assign a calculated value to a dynamic entity field.But the usual format i have seen of assigning a child entity value to a parent entity is
    Dynamicentitylocalvariableofparent["property"]=Dynamicentitylocalvariableofchild[property]

    can anyone tell me is it possible to assign like Dynamicentitylocalvariableofparent["property"]=valueinint;


    Thanks, Aarch
    Monday, June 1, 2009 9:56 AM

Answers

  • Hi
        Do you mean something like that:

    Int32 someint = 0;
    entity["attributename"] = new CrmNumber(someint);
    everything is a matter of probability...
    Monday, June 1, 2009 10:13 AM

All replies

  • Hi, Aarch.

    If properties are integer, you can use following code:

    parent["Property"] = new CrmNumber(((CrmNumber)child["Property"]).Value);

    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
    Monday, June 1, 2009 10:03 AM
    Moderator
  • Thanks a33ik,

    but the issue is that i have a calculated sum of a child entity field which is in int, i want to assign the calculated integer to the dynamic entity property.

    Thanks, Aarch
    Monday, June 1, 2009 10:05 AM
  • Hi
        Do you mean something like that:

    Int32 someint = 0;
    entity["attributename"] = new CrmNumber(someint);
    everything is a matter of probability...
    Monday, June 1, 2009 10:13 AM
  • Hi.

    Pen_2 was faster than I. He wrote ideal code for your purpose )
    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
    Monday, June 1, 2009 10:14 AM
    Moderator
  • Hi Thanks, But i am not getting the value even after assigning like that int part = 30; lead["postal_code"] = new CrmNumber(part);
    Thanks, Aarch
    Monday, June 1, 2009 10:24 AM
  • On what stage have you registered your plugin and what message?
    Monday, June 1, 2009 10:32 AM
  • no its in poststage
    Thanks, Aarch
    Monday, June 1, 2009 10:33 AM
  • If you trying to update property of entity from current context then you should do this in PreStage.
    everything is a matter of probability...
    Monday, June 1, 2009 10:37 AM
  • Hi PEN_2,

    Thanks, it worked :-) but in post stage itself it worked ..

    thanks alot a33ik
    Thanks, Aarch
    Monday, June 1, 2009 11:08 AM