4 Replies Latest reply on Jun 6, 2012 4:17 PM by BruceHerbach

    Commit and Revert

      Dear group,


      I'm building a billing solution in FM12


      When a user modifies the value of a field in a portal (let's say : "FieldX") , stays in FieldX and clicks directly on my validation button the calculated fields based on FieldX are not updated. My script starts to run and the old values are kept for validation.

      Normaly I would solve this problem with a commit script step but as I want to be able to revert the record and the portal I don't want to use that script step.

      I tried "refresh window" and "go to field" but none of those script steps seem to update the calculated fields.

      I would like a script step that would act as if the user had clicked on the background before he clicked on the button.



        • 1. Re: Commit and Revert

          You can simulate clicking on the background by using Go to Field [] without specifying a target field, but this doesn't help you, since it would commit the record, too.


          Try Go to Portal Row [ Get ( ActivePortalRowNumber ) ]; as far as I have tested this, the related fields are updated, subsequent calculations take the new value into account (locally as well as in the “far” table), but the record isn't committed, since the focus is still in the portal.

          1 of 1 people found this helpful
          • 2. Re: Commit and Revert
            Stephen Huston

            If your concern is to "revert" or commit the value based on the outcome of the script, try this.


            On entering the field, run a trigger script to set the pre-existing field value to a $$variable, so it is preserved even when the record commits.. When modifiying or exiting the field, commit the value and then run the script. In the script, reset the field to the $$variable value if the record need "reverting."

            1 of 1 people found this helpful
            • 3. Re: Commit and Revert

              xaviervb wrote:


              I would like a script step that would act as if the user had clicked on the background before he clicked on the button.


              I doubt you want to do that, because clicking on the background will commit the record (or at least attempt to) - and you say you don't want to commit.


              Perhaps going to the next field or to a null object (or selecting the active portal row, as suggested above) might help? It's hard to say for sure without knowing what's being calculated.

              • 4. Re: Commit and Revert

                Expanding on what Stephen suggested, you could use an Onobjectvalidate script trigger.  If the new value fails to meet the requirements,  have the script return false and it should revert the record.


                If it is good, committ the record and everything should update.