Forum Discussion

ShalomEguale's avatar
ShalomEguale
Qrew Member
2 years ago

copy a field value into a new field when a form is saved

Hello, I'm wondering if it's possible to copy a field value into a new field when a form is saved. 

So basically, a person makes a change to a form, saves it and their score changes from 5 to 6, I want to copy the old value ( which is 5 ) into a new field which I created and added to the form so the user can easily see that their score has changed and compare values. I can't think of any way or any formula to do this

Just for context, I'm using the new form builder.

I've done some research online and all I could find was the possibility of using a pipeline. But i would prefer not to use a pipeline. Ideally, the data would change on the form once its saved.

If it's not possible to do it without a pipeline then I'd really appreciate if someone walks me through the steps. 



------------------------------
Shalom
------------------------------
  • Forms will have a difficult time storing the old value without combining a bunch of backwards rules to try and store the current value to some kind of other stored field and then compare if something changed to then store the old value somewhere else. It's odd and not something that I would recommend.

     Per your comment Pipelines is the ideal option for this. Your setup would be: 

    Create a new field to store the old value

    In your Pipeline: 

    Trigger when the record is updated. Include in your field list the value that you want to get the old value for

    After your trigger, perform an update record action where you will set the value of the field that will store the old value. In your mapping - you will set the use the $prev syntax to get and populate the prior value of the field retrieved in Step A of your pipeline. So for example if you are getting the value of 'Score' in your trigger, then in your record update you would pass the value of {{a.$prev.score}] as the input to load into your 'old' field. 



    ------------------------------
    Chayce Duncan
    ------------------------------
    • ShalomEguale's avatar
      ShalomEguale
      Qrew Member

      Hi Chayce,

      Thanks for your help. I'm trying to work on this pipeline and got up to the update record action. However, I'm trying to add the new fields (these are the numeric fields that will hold the old value) but they are not showing up on the drop down list.

      I've encountered this problem many times when trying to use pipelines and i don't know why this happens. I don't know if I'm doing anything wrong or if there's a workaround I can use. I need the fields to store the old data



      ------------------------------
      Shalom Eguale
      ------------------------------
      • ChayceDuncan's avatar
        ChayceDuncan
        Qrew Captain

        Shalom - 

        Do you have them included in the first step as 'Fields for Subsequent Steps'? Since you're going to be updating the record from the 'Trigger' - you will need to make sure that you include these fields so they can be used in the future steps as well. 

        So in your trigger, you would include the field that is changing that you want to log as the 'Trigger on Any of these specific fields' - and then below that field for subsequent steps, you would include that field again. 



        ------------------------------
        Chayce Duncan
        ------------------------------