Saving values into a specific field in a CDT

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 being selected.

For example

When the first choice is selected the array is local!ids: {1)

After the second choice the array is {1,2}

After the third choice the array is {1,2,3} and this can go on


My goal is to have {{name: “”, id: 1}, {name: “”, id: 2}, {name: “”, id: 3}} but what I’m getting is {{name: “”, id: 1}, {name: “”, id: 1}, {name: “”, id: 1}}


Or have = {1,2,3} but I’m getting = {1,1,1}


Does anyone have any idea how to solve this issue?

  • The exact code needed for this depends on some more subtle factors that you haven'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.  Something like the following:

      choiceLabels: {"a", "b"},
      choiceValues: {1, 2},
      value: ri!myCdt.Id,
      saveInto: {
        ri!tempSave, /* could be a local variable instead of rule input */
              Id: fv!item

    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.

 Discussion posts and replies are publicly visible