Interfaces 102 Appian Developer Course

Interface Definition: Expression evaluation error [evaluation ID = 0K0QK] : An error occurred while executing a save: Expression evaluation error: AA Maintenance must be indexed by its corresponding record type fields or relationships

Everything works just fine before I click on the last "Submit" button, where is I got this error message. I  am not really able to visualize what is going on. Could anyone show me the issue or the problem?

a!localVariables(
  local!scheduleMaintenanceRequests: rule!I1_getScheduledMaintenance(10),
  local!selectedPackage,
  local!selectedMaintenanceRequest: local!selectedPackage,
  local!parts: {},
  {
    {
      a!localVariables(
        /* List of steps in the milestone bar */
          local!milestoneBarSteps: {"Select a Package", "Add Items", "Review and Submit"},
        local!currentMilestoneBarStep: 1,
        {
          a!columnsLayout(
            columns: {
              a!forEach(
                items: local!milestoneBarSteps,
                expression: if(
                  /* Completed step */
                  fv!index < local!currentMilestoneBarStep,
                  a!columnLayout(
                    contents: {
                      a!cardLayout(
                        contents: {
                          a!sideBySideLayout(
                            items: {
                              a!sideBySideItem(
                                item: a!richTextDisplayField(
                                  labelPosition: "COLLAPSED",
                                  value: {
                                    a!richTextItem(
                                      text: {
                                        a!richTextIcon(
                                          icon: "check",
                                          altText: "Completed step"
                                        )
                                      },
                                      size: "MEDIUM",
                                      style: "STRONG"
                                    )
                                  },
                                  align: "CENTER"
                                ),
                                width: "MINIMIZE"
                              ),
                              a!sideBySideItem(
                                item: a!richTextDisplayField(
                                  labelPosition: "COLLAPSED",
                                  value: {
                                    a!richTextItem(
                                      text: upper(fv!item),
                                      size: "MEDIUM"
                                    )
                                  },
                                  align: "LEFT"
                                )
                              )
                            }
                          )
                        },
                        /* Link to go to selected step */
                        link: a!dynamicLink(
                          value: fv!index,
                          saveInto: local!currentMilestoneBarStep
                        ),
                        style: "ACCENT",
                        showBorder: false,
                        accessibilityText: "Completed step. Press space to view step."
                      )
                    }
                  ),
                  if(
                    /* Future step */
                    fv!index > local!currentMilestoneBarStep,
                    a!columnLayout(
                      contents: {
                        a!cardLayout(
                          contents: {
                            a!sideBySideLayout(
                              items: {
                                a!sideBySideItem(
                                  item: a!richTextDisplayField(
                                    labelPosition: "COLLAPSED",
                                    value: {
                                      a!richTextItem(
                                        text: fv!index,
                                        size: "MEDIUM",
                                        style:"STRONG"
                                      )
                                    },
                                    align: "CENTER"
                                  ),
                                  width: "MINIMIZE"
                                ),
                                a!sideBySideItem(
                                  item: a!richTextDisplayField(
                                    labelPosition: "COLLAPSED",
                                    value: {
                                      a!richTextItem(
                                        text: upper(fv!item),
                                        size: "MEDIUM"
                                      )
                                    },
                                    align: "LEFT"
                                  )
                                )
                              }
                            )
                          },
                          height: "AUTO",
                          style: "#efefef",
                          marginBelow: "NONE",
                          showBorder: false,
                          accessibilityText: "Future step"
                        )
                      }
                    ),
                    /* Current step */
                    a!columnLayout(
                      contents: {
                        a!cardLayout(
                          contents: {
                            a!sideBySideLayout(
                              items: {
                                a!sideBySideItem(
                                  item: a!richTextDisplayField(
                                    labelPosition: "COLLAPSED",
                                    value: {
                                      a!richTextItem(
                                        text: {
                                          a!richTextIcon(
                                            icon: "hand-o-right",
                                            altText: "Current step",
                                            size: "MEDIUM"
                                          )
                                        },
                                        size: "MEDIUM",
                                        style: "STRONG"
                                      )
                                    },
                                    align: "CENTER"
                                  ),
                                  width: "MINIMIZE"
                                ),
                                a!sideBySideItem(
                                  item: a!richTextDisplayField(
                                    labelPosition: "COLLAPSED",
                                    value: {
                                      a!richTextItem(
                                        text: upper(fv!item),
                                        size: "MEDIUM",
                                        style: "STRONG"
                                      )
                                    },
                                    align: "LEFT"
                                  )
                                )
                              }
                            )
                          },
                          style: "ACCENT",
                          showBorder: false,
                          accessibilityText: "Current step"
                        )
                      }
                    )
                  )
                )
              )
            },
            spacing: "DENSE",
            stackWhen: {"PHONE","TABLET_PORTRAIT"}
          ),
          choose(
            local!currentMilestoneBarStep,
            {
              /*first step*/
              a!forEach(
                items: local!scheduleMaintenanceRequests,
                expression: a!cardLayout(
                  contents: {
                    a!sideBySideLayout(
                      items: {
                        a!sideBySideItem(
                          item: a!imageField(
                            label: "Image",
                            labelPosition: "COLLAPSED",
                            images: {
                              a!documentImage(
                                document: if(
                                  condition: a!isNullOrEmpty(
                                    fv!item['recordType!{4159bc7e-822e-44d7-bdea-42ce7ab5c096}AA Maintenance.relationships.{b3dea6a6-f9d2-4201-a5f7-bb4126b9f6e1}vehicle.fields.{c7d0b689-e98f-4cb7-8477-6c63943b30a0}image']
                                  ),
                                  valueIfTrue: a!EXAMPLE_DOCUMENT_IMAGE(),
                                  valueIfFalse: fv!item['recordType!{4159bc7e-822e-44d7-bdea-42ce7ab5c096}AA Maintenance.relationships.{b3dea6a6-f9d2-4201-a5f7-bb4126b9f6e1}vehicle.fields.{c7d0b689-e98f-4cb7-8477-6c63943b30a0}image']
                                )
                              )
                            },
                            size: "MEDIUM",
                            isThumbnail: false,
                            style: "STANDARD"
                          ),
                          width: "MINIMIZE"
                        ),
                        a!sideBySideItem(
                          item: a!richTextDisplayField(
                            labelPosition: "COLLAPSED",
                            value: {
                              a!richTextHeader(
                                text: {
                                  fv!item['recordType!{4159bc7e-822e-44d7-bdea-42ce7ab5c096}AA Maintenance.relationships.{b3dea6a6-f9d2-4201-a5f7-bb4126b9f6e1}vehicle.fields.{aea56eae-0801-450a-9aa5-5a1a41e48060}year'] & " " & fv!item['recordType!{4159bc7e-822e-44d7-bdea-42ce7ab5c096}AA Maintenance.relationships.{b3dea6a6-f9d2-4201-a5f7-bb4126b9f6e1}vehicle.fields.{41ba4a5a-f36f-474a-b17d-c12f6869260f}make'] & " " & fv!item['recordType!{4159bc7e-822e-44d7-bdea-42ce7ab5c096}AA Maintenance.relationships.{b3dea6a6-f9d2-4201-a5f7-bb4126b9f6e1}vehicle.fields.{19858bdc-1ba7-46b0-8f44-c9bdcbd61fca}model']
                                },
                                size: "MEDIUM"
                              ),
                              a!richTextItem(
                                text: {
                                  fv!item['recordType!{4159bc7e-822e-44d7-bdea-42ce7ab5c096}AA Maintenance.fields.{36dbff6f-ffca-41a0-902e-4e20ed0bc958}issue']
                                }
                              )
                            }
                          )
                        )
                      }
                    )
                  },
                  link: a!dynamicLink(
                    value: fv!item,
                    saveInto: local!selectedPackage
                  ),
                  height: "AUTO",
                  /*esse estilo deixa "selecionado"*/
                  style: if(
                    and(
                      a!isNotNullOrEmpty(local!selectedPackage),
                      fv!item = local!selectedPackage
                    ),
                    "ACCENT",
                    "NONE"
                  ),
                  shape: "ROUNDED",
                  marginBelow: "STANDARD"
                )
              ),
              a!sectionLayout(
                label: "Package Details",
                contents: {
                  rule!AA_DASH_MaintenanceSummaryView(local!selectedPackage)
                },
                showWhen: a!isNotNullOrEmpty(local!selectedPackage)
              )
            },
            {
              /*second step*/
              a!gridLayout(
                headerCells: {
                  a!gridLayoutHeaderCell(label: "Part"),
                  a!gridLayoutHeaderCell(label: "Unit Cost"),
                  a!gridLayoutHeaderCell(label: "Quantity"),
                  a!gridLayoutHeaderCell(label: "Cost"),
                  a!gridLayoutHeaderCell(label: "")

                },
                columnConfigs: {
                  a!gridLayoutColumnConfig(weight: 3 ),
                  a!gridLayoutColumnConfig(weight: 2 ),
                  a!gridLayoutColumnConfig(weight: 1 ),
                  a!gridLayoutColumnConfig(weight: 2 ),
                  a!gridLayoutColumnConfig(width: "ICON")

                },
                rows: a!forEach(
                  items: local!parts,
                  expression: a!gridRowLayout(
                    contents: {
                      a!textField(
                        value: fv!item['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{748b9f99-eb41-4b41-8005-f977d7395c69}name'],
                        saveInto: fv!item['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{748b9f99-eb41-4b41-8005-f977d7395c69}name']
                      ),
                      a!textField(
                        value: fv!item['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{fb926279-1850-4055-ba48-873fc47e1659}unitCost'],
                        saveInto: fv!item['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{fb926279-1850-4055-ba48-873fc47e1659}unitCost']
                      ),
                      a!textField(
                        value: fv!item['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{e3e1df6c-7f95-43c1-b8cd-1f3b0c921cae}qty'],
                        saveInto: fv!item['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{e3e1df6c-7f95-43c1-b8cd-1f3b0c921cae}qty']
                      ),
                      a!textField(
                        value: fv!item['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{e3e1df6c-7f95-43c1-b8cd-1f3b0c921cae}qty'] * fv!item['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{fb926279-1850-4055-ba48-873fc47e1659}unitCost'],
                        readOnly: true
                      ),
                      a!richTextDisplayField(
                        value: a!richTextIcon(
                          icon: "times",
                          link: a!dynamicLink(
                            value: remove(local!parts, fv!index),
                            saveInto: local!parts
                          ),
                          linkStyle: "STANDALONE",
                          color: "NEGATIVE"

                        )
                      )

                    }
                  )
                ),
                addRowLink: a!dynamicLink(
                  label: "Add Item",
                  value: append(
                    local!parts,
                    'recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part'(
                      'recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{748b9f99-eb41-4b41-8005-f977d7395c69}name': null,
                      'recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{fb926279-1850-4055-ba48-873fc47e1659}unitCost': null,
                      'recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{e3e1df6c-7f95-43c1-b8cd-1f3b0c921cae}qty': null
                    )
                  ),
                  saveInto: local!parts


                )

              )
            },
            {
              /* Replace this rich text with the component or rule that should populate this step */
              a!sectionLayout(
                label: "Maintenance Information",
                contents: {
                  a!cardLayout(
                    contents: {
                      a!sideBySideLayout(
                        items: {
                          a!sideBySideItem(
                            item: a!imageField(
                              label: "Image",
                              labelPosition: "COLLAPSED",
                              images: {
                                a!documentImage(
                                  document: if(
                                    condition: a!isNotNullOrEmpty(local!selectedPackage['recordType!{4159bc7e-822e-44d7-bdea-42ce7ab5c096}AA Maintenance.relationships.{b3dea6a6-f9d2-4201-a5f7-bb4126b9f6e1}vehicle.fields.{c7d0b689-e98f-4cb7-8477-6c63943b30a0}image']),
                                    valueIfTrue: local!selectedPackage['recordType!{4159bc7e-822e-44d7-bdea-42ce7ab5c096}AA Maintenance.relationships.{b3dea6a6-f9d2-4201-a5f7-bb4126b9f6e1}vehicle.fields.{c7d0b689-e98f-4cb7-8477-6c63943b30a0}image'],
                                    valueIfFalse: a!EXAMPLE_DOCUMENT_IMAGE()
                                  )
                                )
                              },
                              size: "MEDIUM",
                              isThumbnail: false,
                              style: "STANDARD"
                            ),
                            width: "MINIMIZE"
                          ),
                          a!sideBySideItem(
                            item: a!richTextDisplayField(
                              labelPosition: "COLLAPSED",
                              value: {
                                a!richTextHeader(
                                  text: 
                                  local!selectedPackage['recordType!{4159bc7e-822e-44d7-bdea-42ce7ab5c096}AA Maintenance.relationships.{b3dea6a6-f9d2-4201-a5f7-bb4126b9f6e1}vehicle.fields.{aea56eae-0801-450a-9aa5-5a1a41e48060}year'] & " " &
                                  local!selectedPackage['recordType!{4159bc7e-822e-44d7-bdea-42ce7ab5c096}AA Maintenance.relationships.{b3dea6a6-f9d2-4201-a5f7-bb4126b9f6e1}vehicle.fields.{41ba4a5a-f36f-474a-b17d-c12f6869260f}make'] & " " &
                                  local!selectedPackage['recordType!{4159bc7e-822e-44d7-bdea-42ce7ab5c096}AA Maintenance.relationships.{b3dea6a6-f9d2-4201-a5f7-bb4126b9f6e1}vehicle.fields.{19858bdc-1ba7-46b0-8f44-c9bdcbd61fca}model'],
                                  size: "MEDIUM"
                                ),
                                a!richTextItem(
                                  text: local!selectedPackage['recordType!{4159bc7e-822e-44d7-bdea-42ce7ab5c096}AA Maintenance.fields.{36dbff6f-ffca-41a0-902e-4e20ed0bc958}issue']
                                )
                              }
                            )
                          )
                        }
                      )
                    },
                    height: "AUTO",
                    shape: "ROUNDED",
                    marginBelow: "STANDARD"
                  )
                }
              ),
              a!sectionLayout(
                label: "PARTS",
                contents: {
                  a!gridField(
                    data: local!parts,
                    columns: {
                      a!gridColumn(
                        label: "Part",
                        value: fv!row['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{748b9f99-eb41-4b41-8005-f977d7395c69}name']
                      ),
                      a!gridColumn(
                        label: "Unit Cost",
                        value: fv!row['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{fb926279-1850-4055-ba48-873fc47e1659}unitCost'] 
                      ),
                      a!gridColumn(
                        label: "Quantity",
                        value: fv!row['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{e3e1df6c-7f95-43c1-b8cd-1f3b0c921cae}qty']
                      ),
                      a!gridColumn(
                        label: "Cost",
                        value: fv!row['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{fb926279-1850-4055-ba48-873fc47e1659}unitCost'] * fv!row['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{e3e1df6c-7f95-43c1-b8cd-1f3b0c921cae}qty']
                      ),
                    }
                  )
                },
              ),
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: "Estimate Total: "&
                  if(
                    length(local!parts)>0,
                    sum(local!parts['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{e3e1df6c-7f95-43c1-b8cd-1f3b0c921cae}qty'] * local!parts['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{fb926279-1850-4055-ba48-873fc47e1659}unitCost']),
                    0
                  ),
                  style: "STRONG"
                ),
                align: "RIGHT"
              )
            }

          ),
          a!columnsLayout(
            columns: {
              a!columnLayout(
                contents: {
                  a!buttonArrayLayout(
                    buttons: {
                      a!buttonWidget(
                        label: "Back",
                        value: local!currentMilestoneBarStep - 1,
                        saveInto: local!currentMilestoneBarStep,
                        style: "OUTLINE",
                        showWhen: local!currentMilestoneBarStep > 1
                      ),
                      a!buttonWidget(
                        label: "Cancel",
                        style: if(
                          local!currentMilestoneBarStep = 1,
                          "OUTLINE",
                          "LINK"
                        )
                      )
                    },
                    align: "START"
                  )
                }
              ),
              a!columnLayout(
                contents: {
                  a!buttonArrayLayout(
                    buttons: a!buttonWidget(
                      label: if(
                        local!currentMilestoneBarStep = length(local!milestoneBarSteps),
                        "Submit",
                        "Next"
                      ),
                      saveInto: if(
                        local!currentMilestoneBarStep = length(local!milestoneBarSteps),
                        {
                          a!forEach(
                           items: local!parts,
                           expression:
                           a!save(
                             target: fv!item['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{0ea77c5d-4f9c-40e6-b4cc-7c4498646257}maintenanceId'],
                             value: local!selectedPackage['recordType!{cd5f88a2-e8fd-42ef-9914-a827dccf5023}I1 Part.fields.{0ea77c5d-4f9c-40e6-b4cc-7c4498646257}maintenanceId']
                           )
                          ),
                          a!save(
                            target: ri!parts,
                            values: local!parts
                          ),
                        },
                        a!save(
                          local!currentMilestoneBarStep,
                          local!currentMilestoneBarStep + 1
                        )
                      ),
                      style: "SOLID"
                    )
                  )
                }
              )
            }
          )
        }
      )
    }
    
  }
)

  Discussion posts and replies are publicly visible

Parents Reply Children