Skip to main content
April 25, 2024
Question

SubmitLink() is disabled successfully in object but does not behave correctly when testing on front-end sit

  • April 25, 2024
  • 10 replies
  • 0 views

Hi everyone, 

I'm seeing this behaviour which I cannot explain. Could anyone recommend me a solution or reason for this behaviour?

I'm having an interface with gridField(), one of the grid column's value is richTextIcon() containing a submitLink() to kick off a process model. Please see below the code to build up my grid column: 

a!gridColumn(
          align: "CENTER",
          label: "",
          value: a!localVariables(
            local!showLink: false,
            a!richTextDisplayField(
              value: a!richTextIcon(
                caption: "Re-open Case",
                icon: "folder-open",
                link: a!submitLink(
                  showWhen: local!showLink = false(),
                  saveInto: {
                    a!startProcess(
                      processModel: cons!PRO_PM_REACTIVATE_CASE
                      processParameters: {
                        noteContent: "This case was re-activated",
                        caseId: fv!row['recordType!Test.field.caseId]
                      },
                      onSuccess: {
                        a!save(local!showLink, true)
                        
                      }
                    )
                  }
                ),
                linkStyle: "STANDALONE"
              )
            )
          )
        )

I'm expecting to disable the submit link after user clicking on the icon once. The icon was successfully disabled when I test on that interface, and behaved correctly when I tested on the parent interface also, but coming to site testing, after clicking the icon once, it is still active and I can re-click it as many times as I want. 

Does any one have any idea of how to fix this or possible solution to find the reason? Please help if you do [emoticon:c4563cd7d5574777a71c318021cbbcc8]

Thank you!

    10 replies

    srmm0001
    April 25, 2024
    1. Replace local!showLink = false() with not(local!showLink) in your showWhen attribute to properly evaluate the boolean condition.

    2. Session Variables: Consider using session variables to maintain the state across different interactions within the same user session.
      • Database or Record Fields: Store the state in a database or record field that gets updated when the link is clicked. This is more reliable for maintaining state across different sessions and interfaces.
    3. Ensure the interface where the grid is displayed refreshes after the process is triggered so it can reflect the updated state.

    Note:

    By implementing these changes, you can ensure the submitLink() is disabled after being clicked once, even when tested on the front-end site.

    linhnAuthor
    April 26, 2024

    Hi [mention:cf49bdeb373e4e3bbdb7959269fae5c9:e9ed411860ed4f2ba0265705b8793d05] , thanks for helping. 

    I changed local!showLink = false() with not(local!showLink),and I also added refreshOnVarChange: local!refreshCounter to the gridField(), but still it only works on interface level. 

    Not quite understand how to work on session variable, but will doing it solve the issue?

    stefanhelzle0001
    Brainy
    April 25, 2024

    I am not sure what you are trying to do here.

    A submitLink that tries to start a process in the background does not feel right. A submitLink is meant to submit a process start form or a user input task. But in both situations, it either already starts a process or continues one.

    What kind of interface is this, and where/how is it used.

    What do you try to achieve?

    srmm0001
    April 25, 2024

    Thank you for your input. To clarify, my goal is to enable users to quickly reactivate cases directly from a grid on the interface without navigating away. The submitLink() is used to start a background process that updates the case status upon clicking an icon. This setup aims to enhance user efficiency by reducing navigation and simplifying interactions. Given this, would you recommend a different approach or component for initiating background processes directly from the grid?

    stefanhelzle0001
    Brainy
    April 25, 2024

    Assuming that your case is a record, I suggest to add that process as a record action and use the record action field. Then configure this action to only show up in a specific case status.

    Done!