Skip to main content
thomasm0013
October 29, 2022
Solved

How to process an event only when value changed (to a target value) within an interface?

  • October 29, 2022
  • 4 replies
  • 1 view

Hello,

I want an event to happen (send email) after submitting a user interface (form) only if a certain attribute has been changed. I figured that I would need the old and the new value of this attribute in the process.

What would be a good way to achieve this?

Thank you in advance

    Best answer by stefanhelzle0001

    The trick here is that you will need to save the old value in a local variable set to never refresh. Then you can compare that to the new value. I suggest to put that logic into the saveInto of the submit button. Store that result into a boolean which then controls the process.

    4 replies

    gopalk2865
    Participating Frequently
    October 29, 2022

    hi thomas, you can have a boolean variable which will have true or false when a attribute gets changed , based on this variable you can design your process flow.

    stefanhelzle0001
    Brainy
    October 29, 2022

    The trick here is that you will need to save the old value in a local variable set to never refresh. Then you can compare that to the new value. I suggest to put that logic into the saveInto of the submit button. Store that result into a boolean which then controls the process.

    thomasm0013
    October 29, 2022

    Hello [mention:d73323f9e5264d25a54faa44f3172834:e9ed411860ed4f2ba0265705b8793d05], Hello [mention:126a676c85024855948336691b0a7b92:e9ed411860ed4f2ba0265705b8793d05],

    thank you for your suggestions.

    I was able to achieve my goal doing the following:

    • Interface
      • new rule input valueChanged as Boolean
      • local variable oldValue set to the value I want to monitor by using a!refreshVariable(value: ri![MY_VALUE], refreshOnReferencedVarChange: false)
      • Submit-Button saveInto: a!save(ri!valueChanged, if(local!oldValue<>ri![MY_VALUE], TRUE, FALSE))
    • Process
      • add process variable (and assign it to the rule input)
      • add process logic accordingly

    KR
    Thomas

    stefanhelzle0001
    Brainy
    October 29, 2022

    Great to hear that you get this working. A small hint:

    if(local!oldValue<>ri![MY_VALUE], TRUE, FALSE))

    can be replaced by

    local!oldValue<>ri![MY_VALUE]

    as a comparison always evaluates to a boolean result.