1 Reply Latest reply on May 18, 2016 1:15 AM by bigtom

    How to automatically record an old data from a field to another field when I updated it?

    Angelus81

      I have an inventory database that contains the costs of my products and every certain period of time I will have to update my cost. So, I am thinking if it is possible for me to automatically record an old price from a filed to another when I update the cost?

       

      For example, when I update my "cost" filed (number-filed), the old dollar amount will be copied and pasted to a "old cost" filed (text-field)?

       

      Please help!!!

        • 1. Re: How to automatically record an old data from a field to another field when I updated it?
          bigtom

          Couple of ways to do this,  but they involve scripts.

           

          If you want to edit directly you will need and on object enter script trigger that will safe the value of the field you are in to the "old price" field and the you enter the new one. This has problems because if you decide not to change the price the previous old price will be entered any time you click in the field or modify.

           

          I would suggest using a global field and a Save New Price button that will execute the script:

           

          Set Filed[ oldPrice; currentPrice] //set old price

          Set Filed[ currentPrice; GlobalNewPrice] //set new price from global

          Set Field[ GlobalNewPrice; ""] //clear global after use

           

          How you implement it exactly depends on if you are in a portal or just a record but it is all basically the same.