RuleInput, multidropdown

a!localVariables(
  local!lineOfBusiness: rule!LCM_getLineOfBusinesses(lobkey: null(), lobcode: null()),
  local!attorneys: rule!LCM_getAttorneys(soeid: null(), attorneykey: null()),
  local!selectedAttorney,
  local!selectedAttorneyLOB,
  local!attorneyLOB: { a!map(attorneykey: null(), lobkey: null()) },
  a!formLayout(
    label: "Form",
    contents: {
      a!boxLayout(
        label: "Attorney - Line of Businesses",
        contents: {
          a!gridLayout(
            label: "",
            labelPosition: "ABOVE",
            totalCount: count(local!attorneyLOB),
            headerCells: {
              a!gridLayoutHeaderCell(label: "Attorney(s)"),
              a!gridLayoutHeaderCell(label: "Line of Business"),
              a!gridLayoutHeaderCell(label: "")
            },
            columnConfigs: {
              a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 1),
              a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 1),
              a!gridLayoutColumnConfig(width: "ICON")
            },
            rows: {
              a!forEach(
                items: local!attorneyLOB,
                expression: a!gridRowLayout(
                  contents: {
                    a!dropdownField(
                      label: "Attorney(s)" & fv!index,
                      labelPosition: "ABOVE",
                      helpTooltip: "Attorney(s)",
                      placeholder: "Select a Attorney",
                      choiceLabels: index(local!attorneys, "name", ""),
                      choiceValues: index(local!attorneys, "attorneykey", ""),
                      value: fv!item.attorneykey,
                      saveInto: 
                      {
                        fv!item.attorneykey,
                        a!save(
                          target: ri!intakeattorneys,
                          value: a!forEach(
                            items: local!attorneyLOB,
                            expression: {AttorneyKey: fv!item.attorneykey}
                          )
                         )
                       },
                      required: true
                    ),
                    a!multipleDropdownField(
                      label: "LOB" & fv!index,
                      labelPosition: "ABOVE",
                      placeholder: "Select a Line of Business",
                      choiceLabels: index(local!lineOfBusiness, "lobname", ""),
                      choiceValues: index(local!lineOfBusiness, "lobkey", ""),
                      value: fv!item.lobkey,
                      saveInto: {fv!item.lobkey,
                      
                      a!save(
                        ri!attorneyLineOfBusiness,
                        value: a!forEach(
                          items: local!attorneyLOB,
                          expression: {attorneykey: fv!item.attorneykey, 
                          lobkey: 
                          a!forEach(
                          items: fv!item.lobkey,
                          expression: {lobkey: fv!item}
                          )
                          }
                        )
                      )
                      },
                      required: true
                    ),
                    a!imageField(
                      label: "delete " & fv!index,
                      images: a!documentImage(
                        document: a!iconIndicator("REMOVE"),
                        altText: "Remove",
                        caption: "Remove ",
                        link: a!dynamicLink(
                          value: fv!index,
                          saveInto: {
                            a!save(
                              local!attorneyLOB,
                              remove(local!attorneyLOB, save!value)
                            )
                          },
                          
                        ),
                        showWhen: fv!index > 1
                      ),
                      size: "ICON"
                    )
                  }
                )
              )
            },
            selectionSaveInto: {},
            validations: {},
            shadeAlternateRows: true,
            addRowLink: a!dynamicLink(
              label: "Add",
              saveInto: {
                a!save(
                  local!attorneyLOB,
                  append(local!attorneyLOB, save!value)
                )
              }
            ),
            rowHeader: 1
          )
        },
        style: "STANDARD",
        marginBelow: "STANDARD"
      )
    },
    buttons: a!buttonLayout(
      primaryButtons: {
        a!buttonWidget(
          label: "Submit",
          submit: true,
          style: "PRIMARY"
        )
      },
      secondaryButtons: {
        a!buttonWidget(
          label: "Cancel",
          value: true,
          saveInto: ri!cancel,
          submit: true,
          style: "NORMAL",
          validate: false
        )
      }
    )
  )
)
Hi,

I have a user input with editable grid where each row will have 2 dropdowns.

The first dropdown "Attorney(s)" is a single selection where as "Line of Business" is a multiselection.

I have able to save the attorneykey to the rule input (black arrow in the image), where as I was unable to save/pass lobkey (multiple values) into the rule input.

Can someone give an idea who can I fix this. Thanks in advance.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    What is the CDT definition for the "attourneyLineOfBusiness" rule input?  Is the "lobkey" property single or multiple?

    It looks like every time the multiple dropdown is changed (regardless of the row) you're attempting to overwrite the value of "ri!attourneyLineOfBusiness" with a copy stored in the local!attourneyLOB dictionary where the "lobkey" property is actually multiple values.  If your CDT doesn't have that field defined as an array, then it simply won't work.  I'd also caution that this might not be the best approach for storing multiple row-related values, though i suppose it could work with some fixes to your existing code (i'd suggest fixing the indentation in your a!forEach loops in your saveInto and consider whether you need to list the "lobkey" property name quite so many times, for one...)

  • Please find the below attached AttorneyLineOfBusiness CDT image.

    Also, my both dropdown values are fixed. Values inside the dropdown won't change.

Reply Children
No Data