Answered by:
Insertng the value in to picklist in CRM

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- Marked as answer by DavidJennawayMVP, Moderator Thursday, September 16, 2010 1:59 PM
Friday, August 13, 2010 11:33 PMModerator
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- Marked as answer by DavidJennawayMVP, Moderator Thursday, September 16, 2010 1:59 PM
Friday, August 13, 2010 11:33 PMModerator -
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 valueresult.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.comSaturday, August 14, 2010 5:02 AMModerator