Is there a formula that calculates the due date?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yakup aycıl
    Member
    • Jun 2024
    • 76

    Is there a formula that calculates the due date?

    Click image for larger version

Name:	image.png
Views:	85
Size:	3.5 KB
ID:	112259

    Is there a formula that automatically enters the due date and calculates the due date?

    I tried it but it didn't work; ifThen(not(empty(dueDay)),cDateDate= datetime\diff(today(), cDateDay, 'day'));​​
  • victor
    Active Community Member
    • Aug 2022
    • 727

    #2
    This formula will suit you: https://docs.espocrm.com/administrat...atetimeadddays

    - Three fields are created:
    1. Number of days - Integer type;
    2. Due Date - Date type;
    3. Date Date - Date type.

    - In Administration > Entity Manager > Your_entity_name > Formula > Before Save Custom Script enter the formula (be careful when specifying field names, because they may not start with "c"):
    HTML Code:
    cDueDate = datetime\addDays(cDateDate, cNumberOfDays);
    - You get an automatic calculation in the Due Date field:

    Click image for larger version  Name:	image.png Views:	0 Size:	4.6 KB ID:	112262
    If adding or subtracting days is focused only on the current date, then you do not need the Date Date field and the formula will look like this:
    HTML Code:
    cDueDate = datetime\addDays(datetime\now(), cNumberOfDays);
    Last edited by victor; 11-13-2024, 11:10 AM.

    Comment

    • yakup aycıl
      Member
      • Jun 2024
      • 76

      #3
      Click image for larger version

Name:	image.png
Views:	56
Size:	5.8 KB
ID:	112285
      Hello victor how are you

      I did what you said but it didn't work. Where am I going wrong? Click image for larger version

Name:	image.png
Views:	44
Size:	17.6 KB
ID:	112286

      Comment

      • Stefan
        Member
        • Jul 2021
        • 57

        #4
        Did you recalculate formula?

        Comment

        • yakup aycıl
          Member
          • Jun 2024
          • 76

          #5
          Yes, I calculated it but it still didn't come. Stefan

          Comment

          • victor
            Active Community Member
            • Aug 2022
            • 727

            #6
            Judging by your screenshot, you have confused field Labels and field Names.
            Please send screenshots of the settings of all three fields used in the formula.​

            Comment

            • yakup aycıl
              Member
              • Jun 2024
              • 76

              #7
              No, that's how I defined it.

              Comment


              • victor
                victor commented
                Editing a comment
                You did not send the screenshots that I requested from you, without them it's difficult to say anything.

                As for the formula, it works as it should (checked both formulas personally).
            Working...