Hi,
I have a multipleDropdownField with the attached code.
I am getting an error when I try to select any additional item from the dropdown.
Can someone give me an idea how to fix the issue. Thanks in advance.
Using the below code while Testing the user interface.
rule input:
lcmIntakeDesignatedBusinesses:
Discussion posts and replies are publicly visible
Try This.
a!localVariables( local!designatedBusiness: {'type!{urn:com:appian:types:LCM}LCM_DesignatedBusinesses'('dbkey': 1, 'dbname': "Test-1"), 'type!{urn:com:appian:types:LCM}LCM_DesignatedBusinesses'('dbkey': 2, 'dbname': "Test-2"), 'type!{urn:com:appian:types:LCM}LCM_DesignatedBusinesses'('dbkey': 3, 'dbname': "Test-3"), 'type!{urn:com:appian:types:LCM}LCM_DesignatedBusinesses'('dbkey': 4, 'dbname': "Test-4") }, local!selectedDesignatedBusinesses, a!formLayout( label: "Form", contents: { a!sectionLayout( contents: { a!multipleDropdownField( label: "Designated Business/Function", labelPosition: "ABOVE", helpTooltip: "Designated Business/Function", placeholder: "Select a Designated Business/Function", choiceLabels: index(local!designatedBusiness, "dbname", ""), choiceValues: index(local!designatedBusiness, "dbkey", ""), value: local!selectedDesignatedBusinesses, saveInto: { local!selectedDesignatedBusinesses, }, required: true ) } ),
}, 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 ) } ) ))
When the page loads, I will have few values in the below variable
local!selectedDesignatedBusinesses
I have to be in a position to retain those values in addition to new selections.
Try this:
a!localVariables( local!dbkeysFromRi: ri!lcmIntakeDesignatedBusinesses.dbkey, local!designatedBusiness: { 'type!{urn:com:appian:types:LCM}LCM_DesignatedBusinesses'(dbkey: 1, dbname: "Test-1"), 'type!{urn:com:appian:types:LCM}LCM_DesignatedBusinesses'(dbkey: 2, dbname: "Test-2"), 'type!{urn:com:appian:types:LCM}LCM_DesignatedBusinesses'(dbkey: 3, dbname: "Test-3"), 'type!{urn:com:appian:types:LCM}LCM_DesignatedBusinesses'(dbkey: 4, dbname: "Test-4") }, local!selectedDesignatedBusinesses: if( a!isNullOrEmpty(ri!lcmIntakeDesignatedBusinesses), null(), ri!lcmIntakeDesignatedBusinesses.dbkey ), local!addItems: difference( local!selectedDesignatedBusinesses, local!dbkeysFromRi ), local!removeItems: wherecontains( difference( local!dbkeysFromRi, local!selectedDesignatedBusinesses ), ri!lcmIntakeDesignatedBusinesses.dbkey ), a!formLayout( label: "Form", contents: { a!sectionLayout( contents: { a!multipleDropdownField( label: "Designated Business/Function", labelPosition: "ABOVE", helpTooltip: "Designated Business/Function", placeholder: "Select a Designated Business/Function", choiceLabels: index(local!designatedBusiness, "dbname", ""), choiceValues: index(local!designatedBusiness, "dbkey", ""), value: local!selectedDesignatedBusinesses, saveInto: local!selectedDesignatedBusinesses, required: true ) } ), }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit", submit: true, style: "PRIMARY", saveInto: { a!forEach( local!addItems, a!save( ri!lcmIntakeDesignatedBusinesses, append( ri!lcmIntakeDesignatedBusinesses, 'type!{urn:com:appian:types:LCM}LCM_IntakeDesignatedBusiness'( intakedesignatedbusinesskey: null, intakeheaderkey: null, dbkey: fv!item ) ) ) ), a!save( ri!lcmIntakeDesignatedBusinesses, remove( ri!lcmIntakeDesignatedBusinesses, local!removeItems ) ) } ) }, secondaryButtons: { a!buttonWidget( label: "Cancel", value: true, saveInto: ri!cancel, submit: true, style: "NORMAL", validate: false ) } ) ) )
I have saved the desired values (addition/removal) in the rule input on Submit button saveInto
Thank you so much Sanchit and salute to the login which you have provided to the code.
It is a great help.
Glad to hear that