<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Saving values into a specific field in a CDT</title><link>https://community.appian.com/discussions/f/user-interface/17459/saving-values-into-a-specific-field-in-a-cdt</link><description>Hey all, 
 
 I’m currently trying to save values from an array into a specific field in an array of CDTs. The CDT has fields of name and id. The ids are currently coming from an a multipleDropdownField and are being saved in an array as the choices are</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Saving values into a specific field in a CDT</title><link>https://community.appian.com/thread/68820?ContentTypeID=1</link><pubDate>Wed, 14 Aug 2019 13:53:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cf4eecce-dbb4-4c67-8739-71eeb00014c6</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;The exact code needed for this depends on some more subtle factors that you haven&amp;#39;t included yet, but in general, what I might consider doing in this scenario is to use a!forEach to construct each member of the CDT array per the IDs selected, inside your saveInto.&amp;nbsp; Something like the following:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!multipleDropdownField(
  choiceLabels: {&amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;},
  choiceValues: {1, 2},
  value: ri!myCdt.Id,
  saveInto: {
    ri!tempSave, /* could be a local variable instead of rule input */
    a!save(
      ri!myCdt,
      a!forEach(
        ri!tempSave,
        {
          Id: fv!item
        }
      )
    )
  }
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;An alternative approach would use similar code but in the saveInto of your submit button, basically to build the CDT array upon submission time instead of every time the multiple dropdown field is changed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>