I'd like to store the values of a multipledropdownfield into the a dynamically sized CDT's rule input.

Hello,

I'd like to store the values of a multiple dropdownfield into the fields of an cdt.  So for example, I'd like to make something like the following work:

a!multipleDropdownField(
label: "Category",
placeholder: "Select Category",
choiceLabels: index(local!categoryRefData,"value",{}),
choiceValues: index(local!categoryRefData,"id",{}),
value: index(ri!ctgry, "ctgryId", {}),
saveInto: ri!ctgry.ctgryId
)

How can this be done?

Thanks!

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    If you're relatively sure the "categoryRefData" values will never change, the easiest solution is to make the choiceValues just the local!categoryRefData array, instead of pulling the "id" property from it.  For your value and saveInto parameters, you'd just point it towards ri!ctgry.

    The danger with this approach is that if you're ever in a position where you want to load a form with pre-selected values but any of the category data has changed, the dropdown will sense a mismatch and throw an error.  That's why I avoid assembling a CDT array like this straight from the dropdown, and instead save a basic id array and then, if needed, assemble a CDT array either at form submit or subsequently within the process.

Reply
  • +1
    Certified Lead Developer

    If you're relatively sure the "categoryRefData" values will never change, the easiest solution is to make the choiceValues just the local!categoryRefData array, instead of pulling the "id" property from it.  For your value and saveInto parameters, you'd just point it towards ri!ctgry.

    The danger with this approach is that if you're ever in a position where you want to load a form with pre-selected values but any of the category data has changed, the dropdown will sense a mismatch and throw an error.  That's why I avoid assembling a CDT array like this straight from the dropdown, and instead save a basic id array and then, if needed, assemble a CDT array either at form submit or subsequently within the process.

Children