saving multiple rows in database

Certified Associate Developer

I have a multiselect dropdown with names h1, h2 and there respective ids are 123,456. the interface is to update the codes in site.But when I am selecting both values from dropdown and adding the code, code is not getting added for both the values. It is only getting added for the first value(h1) which I selected initially in the dropdown(h1)

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to harithab835860

    You're only saving for the first selected value. Use a!forEach() to iterate all selections.
    I think, Your addRowLink is creating rows based on dropdown selection count.
    Instead:
    Don't use dropdown length to determine rows - always show one row regardless of selection
    In your saveInto, loop through all selected Ids

    a!forEach(
         items: local!selectedNameIds,
         expression: a!map(id: fv!item, code: local!codeInput)
       )

    This updates the same code for all selected names in one action

Children