Conditional saving on buttons

Is it OK to use this approach for conditional multiple rule input saving on button component?

a!buttonWidget(
            label: "Go Back",
            value: local!activeStep - 1,
            saveInto: {
              local!activeStep,
              if(
                local!activeStep = 1,
                a!save(
                  ri!employee,
                  null
                ),
                null
              ),
              if(
                local!activeStep = 1,
                a!save(
                  ri!address,
                  null
                ),
                null
              ),
              if(
                local!activeStep <> 1,
                a!save(
                  ri!address,
                  rule!EEDM_GetAddressDetailsById(
                    local!startAddressId
                  ).data
                ),
                null
              ),
              if(
                local!activeStep <> 1,
                a!save(
                  ri!employee.addressId,
                  local!startAddressId
                ),
                null
              ),
              if(
                local!activeStep = 2,
                a!save(
                  ri!addressUpdChoice,
                  null
                ),
                null
              )
            }

This is from milestone template which uses the same button on most steps and I need to do specific actions depending on which step I'm on.

To me, it seems fine to use IF conditions in this way and it works fine so far.

However, I haven't run into some examples of this here.

Am I using something undocumented or my "works fine" is just coincidence?

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data