title: set value in the droplink field
body: <p>How do I assign values in a droplink through coding?</p>
  
  <pre><code>Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master");
  Sitecore.Data.Items.Item PriceBookHome = master.GetItem("/sitecore/content/Administration/Price Books/Clarisonic-us-retail");
  string currency = "INR";
  string currenySource = PriceBookHome.Fields["Currency"].Source;
  Sitecore.Data.Items.Item currenyDictSource = master.GetItem(currenySource);
  
  foreach (Item im in currenyDictSource.GetChildren())
  {
  
      if (im.Fields["Key"].Value == currency)
      {
  
          PriceBookHome.Editing.BeginEdit();
          PriceBookHome.Fields["Currency"].SetValue(im.DisplayName, true);
          PriceBookHome.Editing.EndEdit();
      }
  
  }
  </code></pre>
  
  <p>I am getting the following error on the droplink after insertion: "This field contains a value that is not in the selection list"</p>
  
  <p>Error I am getting as follows:</p>
  
  <p><img src="https://i.stack.imgur.com/uEfkB.png" alt="enter image description here"></p>
  
  <p>droplink source[Currency path as given source in droplink]
  <img src="https://i.stack.imgur.com/Nm7d0.png" alt="enter image description here"></p>