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 } ) ), a!save( ri!ALineOfBusinesslobkey, value: a!forEach( items: local!attorneyLOB, expression: { a!forEach( items: fv!item, expression: { attorneykey: fv!item.attorneykey, lobkey: a!foreach( items: fv!item, expression: { lobkey: fv!item.lobkey } ) } ) } ) ) }, 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 ) } ) ) )