locked
Set the value of a currency field using plugin RRS feed

  • Question

  • Hi Guys,

    I am facing a problem in setting the value of crm 2011 currency field using plugin.

    I have value which is of float data type. I am trying to set it to crm currency field ,But unable.

    float total = ((n) + (o) + (p)) / resultcount; newwpl2.Attributes[_pl_tcost] = total;

    The value is shown in newwpl2.attributes but not setting in crm field.

    Where am i going wrong here.

    Thanks & Regards

    Mrpathan.


    Friday, November 23, 2012 11:19 AM

Answers

  • hi mrpathan,

    convert float to decimal to currency type.

    Decimal decValue = (Decimal)total;
    newwpl2.Attributes["_pl_tcost"] = new Money(decValue);


    Thanks and Regards. Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    • Proposed as answer by Ravitheja J Friday, November 23, 2012 11:37 AM
    • Marked as answer by mrpathan Friday, November 23, 2012 11:58 AM
    Friday, November 23, 2012 11:36 AM

All replies

  • hi mrpathan,

    convert float to decimal to currency type.

    Decimal decValue = (Decimal)total;
    newwpl2.Attributes["_pl_tcost"] = new Money(decValue);


    Thanks and Regards. Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    • Proposed as answer by Ravitheja J Friday, November 23, 2012 11:37 AM
    • Marked as answer by mrpathan Friday, November 23, 2012 11:58 AM
    Friday, November 23, 2012 11:36 AM
  • Thanks CRMIG,

    I had Tried this  directly without converting float to decimal.

    Thanks It worked.

    Friday, November 23, 2012 11:59 AM