locked
Insertng the value in to picklist in CRM RRS feed

  • Question

  • Hi,

    I am getting the following error while insertng the value in to picklist in CRM.

     

    0x80040265 Object reference not set to an instance of an object. Platform Platform

    The code is here..

    patientprofile.eu_tcstatus =

    new Picklist();

    patientprofile.eu_tcstatus.Value = 1;

    patientprofile.eu_tcsubstatus =

    new Picklist();

    patientprofile.eu_tcsubstatus.Value = 1;

    serviceTreatment.Update(patientprofile)

    Thanks

    Srikanth

    Friday, August 13, 2010 10:57 PM

Answers

  • Does patientprofile contain a reference to the "Key" attribute?  This attribute should be assigned the value of the record's GUID.
    Dave Berry - MVP Dynamics CRM - http:\\crmentropy.blogspot.com
    Friday, August 13, 2010 11:33 PM
    Moderator

All replies

  • Does patientprofile contain a reference to the "Key" attribute?  This attribute should be assigned the value of the record's GUID.
    Dave Berry - MVP Dynamics CRM - http:\\crmentropy.blogspot.com
    Friday, August 13, 2010 11:33 PM
    Moderator
  • Hi Srikant,

    It seems like you have not retrieved the picklist attribute when you retrieve the entity record. First incluce that column name in the retrieve list of columns. use the below code to assign the picklist value.

    Picklist result = new Picklist();
    result.Value = 1; // specify int value

    result.IsNull = false;
    result.IsNullSpecified = false;

    // assume patientprofile.eu_tcstatus is the entity attribute
    patientprofile.eu_tcstatus = result;

    Hope this works.


    Thanks, Ranjitsingh R | http://mscrm-developer.blogspot.com/ | MS CRM Consultant
    • Proposed as answer by Ranjitsingh R Saturday, August 14, 2010 2:58 AM
    • Edited by Ranjitsingh R Saturday, August 14, 2010 3:08 AM value comments
    Saturday, August 14, 2010 2:58 AM
  • your code for setting picklist seems ok, better to catch soapexception and check for Error details which will give you correct information where is the issue
    Mahain : http://mahenderpal.wordpress.com
    Saturday, August 14, 2010 5:02 AM
    Moderator