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

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -