Skip to main content
chrisg0006
January 29, 2025
Question

a!dropdownField() throws An error occurred while executing a save: java.lang.IllegalArgumentException: Invalid index: Cannot update integer index from type List of Null

  • January 29, 2025
  • 5 replies
  • 0 views

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.

[View:/cfs-file/__key/communityserver-discussions-components-files/13/Dropdown-Field-Error.mp4:899:244]

 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.

5 replies

chrisg0006
January 29, 2025

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.

stefanhelzle0001
January 29, 2025

How do you initialize that local variable?

Why even use a dropdown when there is only a single option?

chrisg0006
January 29, 2025

local!volunteerRequest: null,

Good point.  I wanted to keep it flexible if the business owner wanted to open it up to other events.