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

 Enter image details here

Droplink source [as the source provided in the currency path droplink]  Enter image details here

The id's item must be set as a value, not a name.

  PriceBookHome.Fields ["currency"] = Im.ID.ToString ();    

Comments

Popular posts from this blog

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -