I have a dropdown field that is giving me trouble. It used to work, but just started today.
It throws, "An error occurred while executing a save: java.lang.IllegalArgumentException: Invalid index: Cannot update integer index from type List of Null".
I am interpreting this error message to mean that I am trying to save a Null value into an integer index.
I am limiting the drop down to the latest event. I do not want the applicant to choose any other value except the latest on.
Here is the code:
a!sideBySideItem( item: a!dropdownField( data: null, choiceLabels: rule!PMSO_getEventforLU()[1].event, choiceValues: rule!PMSO_getEventforLU()[1].eventId, label: "I am applying for the following Event", labelPosition: "ABOVE", placeholder: "--- Select an Event to apply ---", value: local!volunteerRequest['recordType!PMSO Volunteer Request.fields.eventId'], saveInto: local!volunteerRequest['recordType!PMSO Volunteer Request.fields.eventId'], searchDisplay: "AUTO", required: true, requiredMessage: "Please select the event you are applying for!" ) ),
Here is the code for the expression rule. It seems to work just find and outputs both the event and eventID.
a!localVariables( local!data: a!queryRecordType( recordType: 'recordType!PMSO Event', fields: { 'recordType!PMSO Event.fields.eventId', 'recordType!PMSO Event.fields.event', 'recordType!PMSO Event.fields.startDate', 'recordType!PMSO Event.fields.endDate', }, pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 100, sort: a!sortInfo( field: 'recordType!PMSO Event.fields.startDate', ascending: false ) ) ).data, a!forEach( items: local!data, expression: a!map( eventId: fv!item['recordType!PMSO Event.fields.eventId'], event: concat( fv!item['recordType!PMSO Event.fields.event'], " (", fv!item['recordType!PMSO Event.fields.startDate'], " - ", fv!item['recordType!PMSO Event.fields.endDate'], ")" ) ) ) )
Here is the output from the expression rule.
Discussion posts and replies are publicly visible
The only change I made from when it used to work to now, is the value and saveinto went from a rule input to a local variable. When working on this screen, I was getting error messages in the Portal referencing the Rule Inputs. In light of the fact, that you can't do a submit to a process model in a Portal, I changed from Rule Inputs to Local Variables.
How do you initialize that local variable?
Why even use a dropdown when there is only a single option?
local!volunteerRequest: null,
Good point. I wanted to keep it flexible if the business owner wanted to open it up to other events.
Try to initialize that local using the record type constructor.
https://docs.appian.com/suite/help/24.4/reference-records.html#use-a-record-type-constructor
So I wasn't trying to save a null into an integer, I was saving an integer into a null.
I changed the initialization to:
local!volunteerRequest: recordtype!PMSO Volunteer Request ().
That is working.
Thank again Stefan!!!!