Workflows: dateEnd not set in Tasks

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • snoo
    Junior Member
    • Apr 2015
    • 26

    Workflows: dateEnd not set in Tasks

    Hi,

    i try to set the dateEnd from a Task from a targetEntityfield.
    Following formula works:
    "dateEnd = datetime\format(targetEntity\attribute('abrechnung stermin1'),,'YYYY-MM-DD hh:mm');"

    now i dont want to set it to this date, but add days to that:

    dateEnd = datetime\addDays(datetime\format(targetEntity\attr ibute('abrechnungstermin1'),,'YYYY-MM-DD hh:mm'), 30);

    this doesnt work.

    I also tried, but doesnt work either:

    dateEnd = datetime\format(tdatetime\addDays(datetime\format( targetEntity\attribute('abrechnungstermin1'),,'YYY Y-MM-DD hh:mm'), 30),,'YYYY-MM-DD hh:mm');

    any idea how to add 30 days with a formula?

    best, mike
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hello
    http://forum.espocrm.com/forum/exten...lt-on-workflow
    think it's better
    dateEnd = datetime\addDays(targetEntity\attribute('abrechnun gstermin1'), 30));
    (why do you use double comma?)
    Last edited by tanya; 07-27-2017, 09:59 AM.

    Comment

    • snoo
      Junior Member
      • Apr 2015
      • 26

      #3
      because i need to set the datetime\format as 'abrechnungstermin1' is a date not a datetime.

      Comment

      • snoo
        Junior Member
        • Apr 2015
        • 26

        #4
        also not working:

        Code:
        $endDate = datetime\format(targetEntity\attribute('abbrechnungstermin1'),null,'YYYY-MM-DD hh:mm');
        dateEnd = datetime\addDays($endDate, 30);

        Comment


        • tanya
          tanya commented
          Editing a comment
          did you try example, I typed?
          what is the type of your field 'abbrechnungstermin1'?

        • snoo
          snoo commented
          Editing a comment
          yes. would be the same as above mention code, but without the minutesDiff, as I pass already 30 days to it.
      • tanya
        Senior Member
        • Jun 2014
        • 4308

        #5
        Ok. I see it is date format. But what time do you want to set? Maybe you don't need a time for task, but only date

        Comment

        • snoo
          Junior Member
          • Apr 2015
          • 26

          #6
          it doesnt matter what time i set.
          the funny thing is, that this works:
          Code:
          dateEnd = datetime\format(targetEntity\attribute('abrechnung stermin1'),,'YYYY-MM-DD hh:mm');
          and now I just want to add 30 Days to this date.
          Shouldn't be too complicated.

          Comment

          • tanya
            Senior Member
            • Jun 2014
            • 4308

            #7

            tried this?
            Code:
            dateEnd = datetime\format(datetime\addDays(targetEntity\attr ibute('abrechnungstermin1'), 30),,'YYYY-MM-DD hh:mm');
            by the way, you could have problem if you change time format in user preferences.
            what about
            Code:
            dateEndDate = datetime\addDays(targetEntity\attribute('abrechnun gstermin1'), 30);
            ?
            in this case time will be empty
            Last edited by tanya; 07-27-2017, 11:04 AM.

            Comment


            • snoo
              snoo commented
              Editing a comment
              dateEnd = datetime\format(datetime\addDays(targetEntity\attr ibute('abrechnungstermin1'), 30),,'YYYY-MM-DD hh:mm');

              did the trick! thank you!
          Working...