Local variable in button saveInto is not saving on one click.

Certified Senior Developer

A cancel button has to save one rule input and one local variable value. If we click on the button once only the rule input changes but the local saving happens only after 2 nd click. If we remove the rule input then it is working. But we need both ri and lccal variable to save its respective values at the first click of button. PFA for the code snippet. Help me on the solution

a!buttonWidget(
              label: cons!PHSREC_BTN_LBL_CANCEL,
              style: "NORMAL",
              value: 3,
              saveInto: {
                local!currentPage,
                a!save(ri!buttonAction,cons!PHSREC_BUTTON_ACTION[6])
               
              },
              validate: false,
              showWhen: local!currentPage = 1              
            ),

  Discussion posts and replies are publicly visible