Workflow for calculating difference between two dates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • camille
    Member
    • Mar 2020
    • 60

    Workflow for calculating difference between two dates

    Hello,

    I'm trying to calculate the difference between two dates as seen in the screenshots below.

    Once the Preview Date and Approval Date are 'not empty', I want the difference between the two dates to be calculated and inputted into the field ReviewPhaseLength.

    What I currently have isn't displaying any results - can someone point me in the right direction? I'm not a developer so I thought making a workflow for this would be easiest.

    Thank you in advance!!

    Camille
    Attached Files
  • yuri
    Member
    • Mar 2014
    • 8453

    #2
    Hi Camille,

    The first mistake I noticed, "days" should be quoted: 'days'. It' should be a string.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • camille
      Member
      • Mar 2020
      • 60

      #3
      Hi Yurikuzn,

      Thank you! I've made this change - it still hasn't updated the field but I think we're on the right track.
      Attached Files

      Comment

      • yuri
        Member
        • Mar 2014
        • 8453

        #4
        You need to remove the field (in the action definition) and leave only formula.

        reviewPhaseLength = datetime\diff( ... )
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • camille
          Member
          • Mar 2020
          • 60

          #5
          Awesome, it's working now. Thank you!

          Comment

          Working...