editable grid-using record Type-Add Row

Im trying to add a new row to the editable grid using record Type data, getting error while saving the row . Anybody help me to Add new row and data entered by user to new row would be synced to record and DB.

a!localVariables(
  local!data:rule!IT_getProductDetailsFromRecord(),
  
  {
  a!cardLayout(
    contents: {
      a!gridLayout(
        label: "Product Details",
        labelPosition: "ABOVE",
        headerCells: {
          a!gridLayoutHeaderCell(label: "Product Id"),
          a!gridLayoutHeaderCell(label: "Name"),
          a!gridLayoutHeaderCell(label: "Category"),
          a!gridLayoutHeaderCell(label: "Price"),
          a!gridLayoutHeaderCell(label: "Brand"),
          a!gridLayoutHeaderCell(label: "Rating")
          
        },
        columnConfigs: {},
        rows: {
          a!forEach(
            items: local!data,
            expression: a!gridRowLayout(
              contents: {
                a!integerField(
                  value: fv!item['recordType!{271af57d-1ea1-4b98-bd80-8092624e72b6}KNS Product Details.fields.{153b4a0d-fa28-42b1-93a8-743296065f94}productid'],
                  saveInto: fv!item['recordType!{271af57d-1ea1-4b98-bd80-8092624e72b6}KNS Product Details']
                ),
                a!textField(
                  value:fv!item['recordType!{271af57d-1ea1-4b98-bd80-8092624e72b6}KNS Product Details.fields.{7d9347e6-175d-4ce7-8518-ac7d3a3188e5}name'],
                  saveInto: fv!item['recordType!{271af57d-1ea1-4b98-bd80-8092624e72b6}KNS Product Details.fields.{7d9347e6-175d-4ce7-8518-ac7d3a3188e5}name']
                ),
                a!textField(
                  value: fv!item['recordType!{271af57d-1ea1-4b98-bd80-8092624e72b6}KNS Product Details.fields.{0bd23d9d-6272-4401-ad24-11178974ad9d}category'],
                  saveInto: fv!item['recordType!{271af57d-1ea1-4b98-bd80-8092624e72b6}KNS Product Details.fields.{0bd23d9d-6272-4401-ad24-11178974ad9d}category']
                ),
                a!integerField(
                  value: fv!item['recordType!{271af57d-1ea1-4b98-bd80-8092624e72b6}KNS Product Details.fields.{479ce285-bbc8-4712-90b5-c171f482c82f}price'],
                  saveInto: fv!item['recordType!{271af57d-1ea1-4b98-bd80-8092624e72b6}KNS Product Details.fields.{479ce285-bbc8-4712-90b5-c171f482c82f}price']
                ),
                a!textField(
                  value: fv!item['recordType!{271af57d-1ea1-4b98-bd80-8092624e72b6}KNS Product Details.fields.{d7bfc7af-8dc8-4918-8bed-72ca1c5ab151}brand'],
                  saveInto: fv!item['recordType!{271af57d-1ea1-4b98-bd80-8092624e72b6}KNS Product Details.fields.{d7bfc7af-8dc8-4918-8bed-72ca1c5ab151}brand']
                ),
                a!floatingPointField(
                  value: fv!item['recordType!{271af57d-1ea1-4b98-bd80-8092624e72b6}KNS Product Details.fields.{dd8acd71-e555-4d3d-81d2-dc28c41273ef}rating']
                  ,
                  saveInto: fv!item['recordType!{271af57d-1ea1-4b98-bd80-8092624e72b6}KNS Product Details.fields.{dd8acd71-e555-4d3d-81d2-dc28c41273ef}rating']
                )
              }
            )
          )
          
        },
        addRowLink: a!dynamicLink(
          label: "Add New Record",
          value: 'recordType!{271af57d-1ea1-4b98-bd80-8092624e72b6}KNS Product Details',
          saveInto: {
            a!save(local!data,append(local!data,save!value))
          }
        ),
        selectionSaveInto: {},
        validations: {},
        shadeAlternateRows: true
      ),
    },
    
    height: "AUTO",
    style: "TRANSPARENT",
    marginBelow: "STANDARD"
  )
}
)

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    Hey,

    This problem arises from an invalid cast because the record name is being appended to record type data without enclosing brackets. To correctly append record type data, ensure you use brackets.

    line 55:

    a!dynamicLink(
    label: "Add New Record",
    value: 'recordType!{271af57d-1ea1-4b98-bd80-8092624e72b6}KNS Product Details'(), /* insert bracket here */ 
    saveInto: {
    a!save(local!data,append(local!data,save!value))
    }

Reply
  • 0
    Certified Associate Developer

    Hey,

    This problem arises from an invalid cast because the record name is being appended to record type data without enclosing brackets. To correctly append record type data, ensure you use brackets.

    line 55:

    a!dynamicLink(
    label: "Add New Record",
    value: 'recordType!{271af57d-1ea1-4b98-bd80-8092624e72b6}KNS Product Details'(), /* insert bracket here */ 
    saveInto: {
    a!save(local!data,append(local!data,save!value))
    }

Children
No Data