Dynamic CRM 2011 Cannot implcity convert type 'string' to 'decimal' RRS feed

  • Question

  • return service.Retrieve("productpricelevel", entityID, newColumnSet(new decimal[] { "amount" })).GetAttributeValue<EntityReference>("extendedamount");

     Thanks for Assistance in advance

    Saturday, December 21, 2013 9:57 AM

All replies

  • Hi,

    Give this a try

    return  service.Retrieve("productpricelevel", entityID, new ColumnSet(new String[] { "amount" })).GetAttributeValue<Decimal>("amount");

    In ColumnSet you will always have String array containing the name of the attributes to be retrieved.


    Shraddha Dhingra


    Sunday, December 22, 2013 3:47 AM
  • Hello Shraddha Dhingra,

    Thank you for your assistance! I entered the code you suggested and now I get an error message stating that "cannot implicity convert type 'decimal' to 'Microsoft.Xrm.Sdk.EntityReference'.

        internal class FindOp
            public static EntityReference findOpp(IOrganizationService service, Guid entityID)
                EntityReference reference = new EntityReference();
                return service.Retrieve("opportunityproduct", entityID, new ColumnSet(new string[] { "opportunityid" })).GetAttributeValue<EntityReference>("opportunityid");

              return service.Retrieve("productpricelevel", entityID, new ColumnSet(new string[] { "amount" })).GetAttributeValue<Decimal>("amount");


    F Johnson

    Monday, December 23, 2013 6:10 PM
  • Hi,

       You can try this option  



    like this

       new Decimal(postImage.GetAttributeValue<Decimal>("amount").Value)



    • Proposed as answer by Vinoth Thiru Saturday, January 4, 2014 9:38 PM
    Monday, December 23, 2013 6:31 PM
  • Hi Shraddha Dhingra,

    You have a function that's supposed to return an Entityreference and you are returning a decimal.

    What is it you would like the function to do?


    Rickard Norström Developer CRM-Konsulterna
    Swedish Dynamics CRM Forum: http://www.crmforum.se
    My Blog: http://rickardnorstrom.blogspot.se

    Friday, December 27, 2013 9:35 AM