Using writeRecord smart service to write multiple records of one recordType .

Hello:

I am trying to use a!writeRecords() to write a list of records (of the same recordType) to the DB and it is writing a column of one-field to each field in the DB (images below).  The debugging section shows the values before I click on 'Submit'.  The second image is the data in the DB (Data Preview screen).

My understanding was that a!writeRecords smart service would insert two records - one for each row of information.  Obviously, I am not correct in my understanding of the service.   How do I get each row to be written as a record in the DB?

As always, thanks for the help!

a!localVariables(
  local!userSelection: null(),
  local!ListOfOptions: rule!FST_getGuidelines(),
  local!ListOfChoiceValues: enumerate(length(local!ListOfOptions)) + 1,
  local!ListOfCategories: {},
  a!formLayout(
    label: "Category Management",
    contents: {
      rule!FST_UserSelection(
        ListOfOptions: local!ListOfOptions,
        ListOfChoiceValues: local!ListOfChoiceValues,
        label: "Select Guideline",
        userChoiceValue: local!userSelection
      ),

      a!sectionLayout(
        marginAbove: "MORE",
        marginBelow: "NONE",
        showWhen: a!isNotNullOrEmpty(local!userSelection),
        label: "Define Categories",
        contents: {
          a!gridLayout(
            rowHeader: 1,
            emptyGridMessage: "No categories defined",
            headerCells: {
              a!gridLayoutHeaderCell(label: "Category Name"),
              a!gridLayoutHeaderCell(
                label: "Description - Examples of items in category"
              ),
              a!gridLayoutHeaderCell(label: ""),
              /*--- column for remove/delete icon ---*/
              
            },
            columnConfigs: {
              a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 1),
              a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 3),
              a!gridLayoutColumnConfig(width: "ICON")
            },
            rows: {
              a!forEach(
                items: local!ListOfCategories,
                expression: a!gridRowLayout(
                  contents: {
                    /* For the category Column*/
                    a!textField(
                      /* Labels are not visible in grid cells but are necessary to meet accessibility requirements */
                      label: "category " & fv!index,
                      value: fv!item['recordType!{533fa657-125c-4f6e-b915-cd29291c4c91}FST Category.fields.{599d40a4-73ed-4cd5-a93e-4aa2739197f4}categoryName'],
                      saveInto: fv!item.['recordType!{533fa657-125c-4f6e-b915-cd29291c4c91}FST Category.fields.{599d40a4-73ed-4cd5-a93e-4aa2739197f4}categoryName'],
                      required: true
                    ),
                    /* For the category description Column*/
                    a!textField(
                      label: "category description " & fv!index,
                      value: fv!item['recordType!{533fa657-125c-4f6e-b915-cd29291c4c91}FST Category.fields.{124c6a28-7f89-4e04-887f-1d13e1adad0e}categoryDefinition'],
                      saveInto: fv!item['recordType!{533fa657-125c-4f6e-b915-cd29291c4c91}FST Category.fields.{124c6a28-7f89-4e04-887f-1d13e1adad0e}categoryDefinition'],
                      required: true
                    ),
                    a!richTextDisplayField(
                      value: a!richTextIcon(
                        icon: "times",
                        altText: "Delete " & fv!index,
                        caption: "Remove " & fv!item['recordType!{533fa657-125c-4f6e-b915-cd29291c4c91}FST Category.fields.{599d40a4-73ed-4cd5-a93e-4aa2739197f4}categoryName'],
                        link: a!dynamicLink(
                          value: remove(local!ListOfCategories, fv!index),
                          saveInto: local!ListOfCategories
                          /*value:fv!index,*/
                          /*saveInto: {a!save(local!ListOfCategories, remove(local!ListOfCategories, save!value))}*/
                        ),
                        linkStyle: "STANDALONE",
                        color: "NEGATIVE"
                      )
                    )
                  },
                  
                )
              )
            },
            addRowLink: a!dynamicLink(
              label: "Add Another Category",
              value: append(
                local!ListOfCategories,
                'recordType!{533fa657-125c-4f6e-b915-cd29291c4c91}FST Category'(
                  'recordType!{533fa657-125c-4f6e-b915-cd29291c4c91}FST Category.fields.{599d40a4-73ed-4cd5-a93e-4aa2739197f4}categoryName': null,
                  'recordType!{533fa657-125c-4f6e-b915-cd29291c4c91}FST Category.fields.{124c6a28-7f89-4e04-887f-1d13e1adad0e}categoryDefinition': null,
                  
                )
              ),
              saveInto: local!ListOfCategories
            ),
            
          )
        }
      ),
      
      /*--- debugging ----*/
      a!sectionLayout(
        marginAbove: "MORE",
        label:"Debugging:",
        contents: {
          a!textField(
          align:"LEFT",
          label:"Guideline Choice",
          labelPosition: "JUSTIFIED",
          readOnly: true(),
          value:local!userSelection
        ),
        a!textField(
          label: "Current Category List:",
          labelPosition: "JUSTIFIED",
          align: "LEFT",
          value: local!ListOfCategories,
          readOnly: true()
        ),
        }
      )
    },
    
    buttons: a!buttonLayout(
      primaryButtons: {
        a!buttonWidget(
          label: "Submit",
          submit: true,
          style: "PRIMARY",
          loadingIndicator: true,
          saveInto: {
            a!writeRecords(
              records: 'recordType!{533fa657-125c-4f6e-b915-cd29291c4c91}FST Category'(
                'recordType!{533fa657-125c-4f6e-b915-cd29291c4c91}FST Category.fields.{599d40a4-73ed-4cd5-a93e-4aa2739197f4}categoryName': local!ListOfCategories['recordType!{533fa657-125c-4f6e-b915-cd29291c4c91}FST Category.fields.{599d40a4-73ed-4cd5-a93e-4aa2739197f4}categoryName'],
                'recordType!{533fa657-125c-4f6e-b915-cd29291c4c91}FST Category.fields.{124c6a28-7f89-4e04-887f-1d13e1adad0e}categoryDefinition': local!ListOfCategories['recordType!{533fa657-125c-4f6e-b915-cd29291c4c91}FST Category.fields.{124c6a28-7f89-4e04-887f-1d13e1adad0e}categoryDefinition'],
                'recordType!{533fa657-125c-4f6e-b915-cd29291c4c91}FST Category.fields.{b0ea631f-738c-40ed-8485-bc12af93a7fa}guidelineReference': tostring(
                  local!ListOfOptions,
                  local!userSelection
                )
              ),
              
            )
          }
        )
      },
      secondaryButtons: {
        a!buttonWidget(
          label: "Cancel",
          value: true,
          saveInto: {},
          submit: true,
          style: "NORMAL",
          validate: false
        )
      }
    )
  )
)

  Discussion posts and replies are publicly visible