How to get old and new field value from model through snippet/javascript

Is there a way to see the old value of a field in snippet so that i can compere old and new value.

Example
Suppose user has selected ‘ABC’ value from PicklistA, then user select ‘XYZ’ value from the same PicklistA then through model’s action, i want to compare old and new value.

You can create a ui-only model (call ChangeLog or something) that has 2 fields called

  • ChangeValue - text type
  • ChangeValueTimestamp - formula field, returns datetime, and inside formula use NOW() function to store the time the user selected the value (might be helpful for comparison)

Every time user selects a different value from PicklistA, you create a new row in ChangeLog to store that value. Your ChangeLog model can then be analyzed for whatever your use case is. Then within the model that has the field with PicklistA, create a model action that empties ChangeLog model every time user saves changes if you want to reset ChangeLog after the save is made

This is obviously not efficient if you need to keep track of data changes in the UI for every single field, but it might do for an one-off situation

Hi Huyen,  Thanks for your response :slight_smile: ,

Actually, i want to do further actions based on this comparison and user can change this picklist value multiple time during the process…

i had read the same query/problem somewhere in the skuid community support portal and that had provided some snippet code for it but the issue is that now i am not able to find that post. i don’t want to user UIOnly field as i need to maintain it always. 

Thanks,
Akanksha

Akanksha, what kind of a snippet are you dealing with, and in what context? Is it a Custom Field Renderer snippet?

Did some googling and found this post with a snippet https://community.skuid.com/t/access-previous-value-of-field