Skip to main content
January 15, 2025
Question

how to refersh page while deleting a data

  • January 15, 2025
  • 2 replies
  • 0 views

hi all,

I have created announcement page where I have implemented delete button on the card 
when user click on that delete button that aprticular announcement deltes but page doesnt refreshes 

please help me achieve this 

a!localVariables(
  local!refreshVar: 0,
  local!bannerType,
  local!textValue1,
  local!textValue2,
  local!showInformationBanner: false,
  local!currentKeyword,
  local!selectedKeyword,
  local!announcementList:a!refreshVariable(
    value: rule!SLS_QRY_getAnnouncementDetails(
      title:local!selectedKeyword
    ),
    refreshOnVarChange: local!refreshVar,
    /*refreshAlways: true*/
  ),
  local!announcementDetails: 'recordType!{71a7c745-7557-423b-b26e-5ea2b74ed0fa}SLS Announcement Sync'(
    'recordType!{71a7c745-7557-423b-b26e-5ea2b74ed0fa}SLS Announcement Sync.fields.{616d2803-cf38-4c6b-93c1-81b0eeb76d52}announcementDate':now(),
    'recordType!{71a7c745-7557-423b-b26e-5ea2b74ed0fa}SLS Announcement Sync.fields.{d18a41cf-dce9-4456-8339-0344b4668242}createdBy': loggedInUser(),
    'recordType!{71a7c745-7557-423b-b26e-5ea2b74ed0fa}SLS Announcement Sync.fields.{83278169-8afa-498f-8d6e-166ac83dbde2}createdOn': now(),
    'recordType!{71a7c745-7557-423b-b26e-5ea2b74ed0fa}SLS Announcement Sync.fields.{71c1c0ad-3948-41be-9b92-f7b791ad84ee}isDeleted': false
  ),
  {
    
    /*Create Button*/
    a!columnsLayout(
      columns: {
        a!columnLayout(width: "AUTO"),
        a!columnLayout(width: "AUTO"),
        a!columnLayout(
          contents: a!cardLayout(
            contents: {
              a!richTextDisplayField(
                labelPosition: "COLLAPSED",
                value: {
                  a!richTextIcon(
                    icon: "plus-square",
                    showWhen: true,
                    color: "POSITIVE",
                    size: "MEDIUM"
                  )
                },
                tooltip: "Click here to Publish New Announcement",
                align: "CENTER"
              )
            },
            link: a!startProcessLink(
              processModel: cons!SLS_PM_CREATE_ANNOUNCEMENT,
              processParameters: {
                announcementDetails: local!announcementDetails
              },
            ),
            shape: "SEMI_ROUNDED",
            accessibilityText: "Publish New Announcement"
          ),
          width: "EXTRA_NARROW"
        ),
      },
      marginAbove: "STANDARD",
      marginBelow: "NONE",
      showWhen: rule!SLS_IsuserMemberofAdministratorGroup(
        loggedInUser()
      )
    ),
    
    /*Announcement List*/
    a!sectionLayout(
      contents: {
        a!forEach(
          items: local!announcementList,
          expression: a!cardLayout(
            contents: {
              a!columnsLayout(
                columns: {
                  a!columnLayout(
                    contents: {
                      a!columnsLayout(
                        columns: {
                          a!columnLayout(
                            contents: {
                              a!cardLayout(
                                contents: {
                                  a!cardLayout(
                                    contents: {
                                      a!richTextDisplayField(
                                        labelPosition: "COLLAPSED",
                                        value:a!defaultValue(text(fv!item['recordType!{71a7c745-7557-423b-b26e-5ea2b74ed0fa}SLS Announcement Sync.fields.{616d2803-cf38-4c6b-93c1-81b0eeb76d52}announcementDate'], "MMM"),""),
                                        align: "CENTER"
                                      )
                                    },
                                    style: "ACCENT",
                                    padding: "EVEN_LESS",
                                    showBorder: false
                                  ),
                                  a!cardLayout(
                                    contents: {
                                      a!richTextDisplayField(
                                        labelPosition: "COLLAPSED",
                                        value: {
                                          a!richTextItem(
                                            text: day(fv!item['recordType!{71a7c745-7557-423b-b26e-5ea2b74ed0fa}SLS Announcement Sync.fields.{616d2803-cf38-4c6b-93c1-81b0eeb76d52}announcementDate']),
                                            size: "MEDIUM_PLUS",
                                            style: "STRONG"
                                          )
                                        },
                                        align: "CENTER"
                                      )
                                    },
                                    padding: "EVEN_LESS",
                                    showBorder: false
                                  )
                                },
                                padding: "NONE",
                                marginBelow: "STANDARD"
                              )
                            },
                            width: "EXTRA_NARROW"
                          ),
                          a!columnLayout(
                            contents: {
                              a!columnsLayout(
                                columns: {
                                  a!columnLayout(
                                    contents: {
                                      a!richTextDisplayField(
                                        labelPosition: "COLLAPSED",
                                        value: {
                                          a!richTextItem(
                                            text: fv!item['recordType!{71a7c745-7557-423b-b26e-5ea2b74ed0fa}SLS Announcement Sync.fields.{d73afdfd-1ab3-4bff-9857-5d342830dcd3}title'],
                                            size: "MEDIUM",
                                            style: "STRONG"
                                          ),
                                          char(10),
                                          a!richTextItem(text:fv!item['recordType!{71a7c745-7557-423b-b26e-5ea2b74ed0fa}SLS Announcement Sync.fields.{5dbe130e-638e-4d38-98e6-33e05653f135}details'])
                                        }
                                      )
                                    }
                                  )
                                },
                                marginBelow: "NONE",
                                spacing: "SPARSE",
                                showDividers: true
                              )
                            }
                          ),
                        },
                        marginBelow: "NONE",
                        showDividers: true
                      )
                    },
                    width: "WIDE"
                  ),
                  a!columnLayout(
                    contents: {
                      a!richTextDisplayField(
                        labelPosition: "COLLAPSED",
                        value: {
                          char(10),
                        }
                      ),
                      a!sideBySideLayout(
                        items: {
                          a!sideBySideItem(
                            item: a!buttonArrayLayout(
                              buttons: {
                                a!buttonWidget(
                                  icon: "remove",
                                  size: "SMALL",
                                  color: "NEGATIVE",
                                  width: "MINIMIZE",
                                  style: "LINK",
                                  saveInto: {
                                    a!startProcess(
                                      processModel: cons!SLS_PM_CREATE_ANNOUNCEMENT,
                                      processParameters: {
                                        isDeleted:true,
                                        announcementDetails: 
                                        a!update(
                                          data:fv!item,
                                          index: 'recordType!{71a7c745-7557-423b-b26e-5ea2b74ed0fa}SLS Announcement Sync.fields.{71c1c0ad-3948-41be-9b92-f7b791ad84ee}isDeleted',
                                          value: true()
                                        )
                                      },
                                      onSuccess: {
                                        a!save(local!refreshVar, local!refreshVar + 1),
                                        a!save(local!showInformationBanner, true),
                                        a!save(
                                          local!bannerType,
                                          cons!SLS_TEXT_BANNER_TYPE_VALUES[4]
                                        ),
                                        a!save(local!textValue1, "Success"),
                                        a!save(
                                          local!textValue2,
                                          cons!SLS_CONFIRMATION_UI_TEXT[16]
                                        )
                                      },
                                      onError: {
                                        a!save(local!refreshVar, local!refreshVar + 1),
                                        a!save(local!showInformationBanner, true),
                                        a!save(
                                          local!bannerType,
                                          cons!SLS_TEXT_BANNER_TYPE_VALUES[2]
                                        ),
                                        a!save(local!textValue1, "Error"),
                                        a!save(
                                          local!textValue2,
                                          "Some thing went wrong."
                                        )
                                      }
                                    ),

                                  },
                                  confirmHeader: "Confirm",
                                  confirmMessage: "Are you sure you want to delete?",
                                  confirmButtonLabel: "Yes",
                                  cancelButtonLabel: "No",
                                  tooltip: "Click here to Delete."
                                )
                              },
                              
                              align: "END",
                              marginbelow: "NONE"
                            ),
                            width: "10X"
                          )
                        },
                        alignVertical: "MIDDLE"
                      )
                    },
                    width: "AUTO"
                  )
                }
              )
            },
            shape: "SEMI_ROUNDED",
            showBorder: false(),
            showShadow: true(),
            marginBelow: "LESS"
          )
        )
      },
      marginAbove: "STANDARD"
    )
  }
)

    2 replies

    stefanhelzle0001
    January 15, 2025

    That startProcess in line 172 makes the process run in the background. Use the parameter isSynchronous to make it synchronous. Then it will wait for theat process to complete before refreshing the screen.

    https://docs.appian.com/suite/help/24.4/Start_Process_Smart_Service.html#handle-a!startprocess()-results

    January 16, 2025

    Thankyou stefan for your responce, 
    my issue is resolved by using rule input as refreshonvarchange on ER from where I'm gettng data then using this refreshonvarchange as parameter on rule! from where data is coming then using local!refreshVar on this parameter