sitecore - set value in the droplink field -
How to assign values to droplinks via coding?
Sitecore.Data.Database master = Sitcom. Configuration.feature Gate database ("master"); Sitecore.Data.Items.Item PriceBookHome = master.GetItem ("/ sitore / content / administration / value books / clerical-us-retail"); String currency = "INR"; String Crisis Source = PricesBook. Field ["currency"]. Source; Sitecore.Data.Items.Item currenyDictSource = master.GetItem (currenySource); Foreign currency (item im currenyDictSource.GetChildren ()) {if (im.Fields ["key"]. Value == currency) {PriceBookHome.Editing.BeginEdit (); PriceBookHome.Fields ["currency"]. SetValue (im.DisplayName, true); PriceBookHome.Editing.EndEdit (); }} I get the following error on the dropline after the entry. "This field contains a value that is not in the selection list"
Getting the form of an error
Droplink source [as the source provided in the currency path droplink]
The id's item must be set as a value, not a name.
PriceBookHome.Fields ["currency"] = Im.ID.ToString ();
Comments
Post a Comment