Quantcast
Channel: CRM Development Forum
Viewing all articles
Browse latest Browse all 888

MS crm 2011 - storing the values from ddl to option set in c#.NET

$
0
0

Hi

How to (in MS crm 2011) - store the values from ddl to option set in c#.NET

I am having a page(.aspx) has ddl. which pulls the states from the MS CRM 2011 Option Set.

Then when I submit the page, it has to store the ddl value into the Custom entity in crm 2011.

But this is giving error "newEntity.new_StateOption is null"

public static bool CreatePortalUser(UserInfo newUser)
        {
            bool saveResult = false;
            var xrm = new XrmServiceContext("Xrm");
           
            using (xrm)
            {
                new_users newEntity = new new_users();


                newEntity.new_City = newUser.City;
                newEntity.new_State = newUser.State;
                newEntity.new_StateOption.Value = newUser.StateOption;
                newEntity.new_Zipcode = newUser.Zip;
.
.
.
.
.


In the newEntity.new_StateOption is of following type:

[Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("new_stateoption")]
  public Microsoft.Xrm.Sdk.OptionSetValue new_StateOption
  {
   get
   {
    return this.GetAttributeValue<Microsoft.Xrm.Sdk.OptionSetValue>("new_stateoption");
   }
   set
   {
    this.OnPropertyChanging("new_StateOption");
    this.SetAttributeValue("new_stateoption", value);
    this.OnPropertyChanged("new_StateOption");
   }
  }


Thanks, Rajeev


Viewing all articles
Browse latest Browse all 888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>