Displaying a richTestField for limit set of time

Hello All,

I have requirement where I need to display a message if my integration call returns false, and that message should disappear after sometime or user refresh the form. To display the message i am using rule input Boolean variable. If user submit the task and in process user receive false from integration call user  gets reverted back to task with the value and we are displaying the message. I tried using of refresh variable but not able to find the exact solution. Please suggest.

Thanks!!!

  Discussion posts and replies are publicly visible

Parents Reply Children
  • a!localVariables(
      local!isInitiationValid: true,
      local!result,
      a!formLayout(
        label: "Form",
        contents: {
          a!sectionLayout(
            contents: {}
          ),
          a!sectionLayout(
            label: "Section",
            contents: {
              a!textField(
                label: "ri!isInitiationValid",
                value: ri!isInitiationValid,
                readOnly: true
              ),
              a!textField(
                label: "local!isInitiationValid",
                value: local!isInitiationValid,
                readOnly: true
              ),
              if(
                ri!isInitiationValid,
                {},
                rule!TestMessage(
                  isInitiationValid: ri!isInitiationValid
                )
              )
            }
          )
        },
        buttons: a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(
              label: "Complete",
              style: "PRIMARY",
              saveInto: {
                rule!TestIntegration(
                  customId: "abcd",
                  ProjectId: "123",
                  onSuccess: {
                    a!save(
                      local!result,
                      a!fromJson(
                        fv!result.body
                      )
                    )
                  }
                ),
                a!save(
                  ri!isInitiationValid,
                  index(
                    local!result,
                    "IsInitiationValid",
                    ""
                  )
                ),
                a!save(
                  local!isInitiationValid,
                  ri!isInitiationValid
                )
              },
              submit: true
            )
          },
          secondaryButtons: {}
        )
      )
    )

    hello Mike,

    In process model, if the ri!isInitiationValid is false, i am routing the path back to user input task and displaying the message. here comes the challenge that, the message should go once user refresh the page. 

  • +1
    Certified Lead Developer
    in reply to Ravi Roshan

    You should still be able to utilize a!refreshVariable() to conditionally show some extra information (like a section, or really anything else you want) for a particular time span after the form is initially loaded.  After you get that working, you could still bake in a user-clickable "dismiss" option or various other possibilities, as long as you figure out the rather easy logic involved.

    This example has a section that should stay for around 30 seconds:

    a!localVariables(
      local!isInitiationValid: true,
      local!result,
    
      local!refreshTime: a!refreshVariable(
        value: now(),
        refreshInterval: 0.5
      ),
      local!pageLoadTime: a!refreshVariable(
        value: local!refreshTime,
        refreshOnReferencedVarChange: false()
      ),
      
      a!formLayout(
        label: "Form",
        contents: {
          a!sectionLayout(
            label: "Error Message",
            showWhen: local!refreshTime = local!pageLoadTime,
            contents: {
              /* Error Message Contents (will go away after first 30-second refresh) */
            }
          ),
          a!sectionLayout(
            label: "Section",
            contents: {
              a!textField(
                label: "ri!isInitiationValid",
                value: ri!isInitiationValid,
                readOnly: true
              ),
              a!textField(
                label: "local!isInitiationValid",
                value: local!isInitiationValid,
                readOnly: true
              ),
              if(
                ri!isInitiationValid,
                {},
                rule!TestMessage(
                  isInitiationValid: ri!isInitiationValid
                )
              )
            }
          )
        },
        buttons: a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(
              label: "Complete",
              style: "PRIMARY",
              /*saveInto: {*/
                /*rule!TestIntegration(*/
                  /*customId: "abcd",*/
                  /*ProjectId: "123",*/
                  /*onSuccess: {*/
                    /*a!save(*/
                      /*local!result,*/
                      /*a!fromJson(*/
                        /*fv!result.body*/
                      /*)*/
                    /*)*/
                  /*}*/
                /*),*/
                /*a!save(*/
                  /*ri!isInitiationValid,*/
                  /*index(*/
                    /*local!result,*/
                    /*"IsInitiationValid",*/
                    /*""*/
                  /*)*/
                /*),*/
                /*a!save(*/
                  /*local!isInitiationValid,*/
                  /*ri!isInitiationValid*/
                /*)*/
              /*},*/
              submit: true
            )
          }
        )
      )
    )

  • Thanks Mike. This worked. 

    Just small change i made to make it as per my requirement because as per your code the message was reappearing whenever the form was reloading. So I made pageLoadTime as rule input and storing the value while getting the integration call and getting the difference to show the message.