Using calculation field for showing the date of when a certain field is updated

Comments

5 comments

  • Darius

    You can create a calculation field and have globiflow update it every time you change a record.

    For example, I have a note app with a date (which is just "created on" date field).

    I have another date field which is blank.

    On globiflow, I create a flow with a trigger on the description field for the app. When I change something in the description, globiflow automatically updates the date to the current date.

    I also have another calculated filed which calculates the number of days between when the record was created and the last updated. This tells me how many days is it been since I last updated this document.

    Hope this helps.

    Here is the code.

    Field name: Days since created

    Code : 

    var d1 = moment(@Date);
    var d2 = moment(@Last updated on);
    var result = d2.diff(d1, 'days')+1;
    result;
    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi Daniel,

    in the calculation field enter the tokens for those "certain" fields:

    //@field 1 @field 2 @field 3
    moment().toDate() 

    like in this example

    When you create the calculation field it will show current date and time. Each time one of the listed fields is changed it will update date/time to the date/time it was changed. 

    An alternative is using Globiflow (as Darius mentioned it): 
    Add a date field to the app and build a flow with filters: When item is updated AND [field 1] changed OR [field 2] changed OR [field 3] changed, update item [date field] == Value [current date & time].

    Rainer

    1
    Comment actions Permalink
  • Daniel Nielsen

    Thank you for your suggestion, Rainer

    The problem is however, that this code also records when you edit or change the template for that app. The same goes for some of the similar solutions I have found in the community. 

    Is there a way to get around this?

    (P.s. I unfortunately do not have Globiflow)

    0
    Comment actions Permalink
  • Darius

    Hi Daniel,

    When trying your code moment().toDate().

    Is "toDate" the actual field name that you are using?

    I have created a field name called "Created on" and tried the followings and I get an error:

    Created a calculation field with the following values:

    Filed name: Created on, value = @Created on (which probably I don't even need)

    Last updated on = moment().Created on()  (I get an error)

    Last updated on = moment().toDate() 

    The calculation field must reference at least one other field. It cannot be entirely based on static data, such as strings or numbers.

    Any idea?

    Thanks

     

    0
    Comment actions Permalink
  • Daniel Nielsen

    Hi Darius

    You don't need "new Date()", if you only need the field to show the created date of the post. In that case you only have to add the @Created on -tag in the calculation field.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk