Problem in deleting a row in a gridRowLayout

Hi,

I have a grid row layout and added an remove icon at the end for each row.

When I click on remove icon, row is deleting from the UI but it is not deleting from the database.

I used the below code for removing the grid row from the UI

link: a!dynamicLink(
            value: ri!clickedRow,
            saveInto: {
              a!save(
                ri!data,
                remove(
                  ri!data,
                  ri!index
                )
              )
            }
          )

Could anyone please help me how to delete the row from the table through the interface

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    You need to save deleted row PK ids into a rule input and pass those values to process. In your process use delete data store entity smart service to delete those record using those IDs. 

    You can use below logic to save your deleted IDs

    link: a!dynamicLink(
      value: ri!clickedRow,
      saveInto: {
        if(
          a!isNullOrEmpty(fv!item.id),
          {},
          a!save(
            ri!deletedIds,
            append(
              ri!deletedIds,
              fv!item.id /*Primary Key of that row*/
            )
          )
        ),
        a!save(
          ri!data,
          remove(
            ri!data,
            ri!index
          )
        )
      }
    )

  • Hi Naresh,

    Thanks for your response. I have used a!deleteFromDataStoreEntities in interface

    link: a!dynamicLink(
                value: ri!clickedRow,
                saveInto: {
                  a!save(
                    ri!data,
                    remove(
                      ri!data,
                      ri!index
                    )
                  ),
    			  a!deleteFromDataStoreEntities(
                      dataToDelete: {
                        entity: cons!CDT_Name, identifiers: ri!data[ri!index].Id
                      }
                    )
                }
              )


    But still it is not deleting from database. Could anyone please help me on this

Reply
  • Hi Naresh,

    Thanks for your response. I have used a!deleteFromDataStoreEntities in interface

    link: a!dynamicLink(
                value: ri!clickedRow,
                saveInto: {
                  a!save(
                    ri!data,
                    remove(
                      ri!data,
                      ri!index
                    )
                  ),
    			  a!deleteFromDataStoreEntities(
                      dataToDelete: {
                        entity: cons!CDT_Name, identifiers: ri!data[ri!index].Id
                      }
                    )
                }
              )


    But still it is not deleting from database. Could anyone please help me on this

Children