Announcement

Collapse
No announcement yet.

Timer Intermediate Event (Catching) Formula problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Timer Intermediate Event (Catching) Formula problem

    Hello,
    Formula scripts for Timer Intermediate Event (Catching) should return Date-Time value that's right?
    I want stop the flow for the next working day (without Saturday and Sunday).
    I got Status: failed. where is the mistake?

    HTML Code:
    $daynumber = datetime\dayOfWeek(datetime\now());
    ifThen($daynumber == 0 || $daynumber == 1 || $daynumber == 2 || $daynumber == 3 || $daynumber == 4,
    datetime\addDays(datetime\now(), 1));
    ifThen($daynumber == 5, datetime\addDays(datetime\now(), 3));
    ifThen($daynumber == 6, datetime\addDays(datetime\now(), 2));

  • #2
    Hello,

    The error may be in the logic of constructing the task itself and in the formula.
    Please give more details about your Flowchart.

    Comment


    • #3
      It looks like on the screen. I attached BPM .csv https://we.tl/t-IOFy87N7OD
      Thank you for your interest.

      Comment


      • #4
        Hi there,
        Your formula returns error 500. Unfortunatelly I don't have Advanced Pack so far so I can't check this issue in EspoCRM log.
        Could you do this:
        1. Run your flowchart
        2. Open the corespondent Process
        3. Open the Timer Intermediate Event -> Click "Start flow from here" (see screenshot)
        4. Provide an EspoCRM log file https://docs.espocrm.com/administrat...ng/#check-logs
        Attached Files

        Comment


        • #5
          Hello Maximus, logs below:
          Code:
          2021-05-06 04:51:16] DEBUG: BPM: processTriggeredSignals [] []
          [2021-05-06 04:51:26] DEBUG: BPM: prepareFlow, process 60904bc9a8dcf13bc, element 69d5c5qszf [] []
          [2021-05-06 04:51:26] DEBUG: BPM: endProcessFlow, node 609375ce561092e29 [] []
          [2021-05-06 04:51:26] DEBUG: BPM: tryToEndProcess, process 60904bc9a8dcf13bc [] []
          [2021-05-06 04:51:26] DEBUG: API (500) POST /BpmnProcess/action/startFlowFromElement; Input data: {"processId":"60904bc9a8dcf13bc","elementId":"69d5 c5qszf"}; Route pattern: /{controller}/action/{action}; Route params: Array ( [controller] => BpmnProcess [action] => startFlowFromElement ) [] []
          [2021-05-06 04:51:26] ERROR: (500) POST /BpmnProcess/action/startFlowFromElement; line: 48, file: /var/www/mypage.com/htdocs/espo/espocrm/EspoCRM-4.8.4/application/Espo/Modules/Advanced/Core/Bpmn/Elements/EventIntermediateTimerCatch.php [] []
          [2021-05-06 04:52:17] DEBUG: BPM: processPendingFlows [] []

          Comment


          • #6
            Unfortunately it isn't to informative. Could you open the file /application/Espo/Modules/Advanced/Core/Bpmn/Elements/EventIntermediateTimerCatch.php and check what is defined on line 48?
            Note: do not post any part of the code from this file or any other file relaited to paid extension. Also do not attach this file here.

            Comment


            • #7
              I am not a programmer so I do not know if I will read it correctly. I think on line 48 an error is returned if variables do not satisfy the condition: !value || !is_string

              Comment


              • #8
                I think it is not working because it is not allowed to use such hard formula logic within the Timer Intermediate Event. It should be done with single directive e.g.:
                Code:
                datetime\addDays(datetime\now(), 1)
                In order to apply more flexible logic you want you need to describe this logic in the Script Task and store the desired date value into a variable (in my case it is $step). Please take a look at the screenshots below to understend what I mean.
                Please pay attantion I put $$ before 'step' in the Timer Intermediate Event regarding to this rule mentioned here https://docs.espocrm.com/administrat...d-http-request
                Attached Files

                Comment


                • #9
                  Maximus I did according to your advice, but now I get the error: Error 500:" function: datetime \ addDays, index: 2, should be: numeric "

                  Comment


                  • #10
                    It seems it broadcasted the int value variable as a string. Please make sure you didn't wrap $$step into quotes as datetime\addDays(datetime\now(), '$$step').
                    In case it the variable wasn't wrapped, DEN could you try to reproduce this issue regarding my last example? Please try to figure out why it is not an integer value.

                    Comment


                    • #11
                      I didn't wrap $$step into quotes.

                      Comment


                      • #12
                        Hello,

                        I investigated this and got the same error.
                        Maybe bug.
                        I have already reported this to the development team, I'll keep you informed.

                        Comment


                        • #13
                          Hello,
                          some news?

                          Comment


                          • #14
                            It's not correct to use `$$variable` syntax in formula. It's not supported. Use `$variable`.
                            Last edited by yuri; 06-22-2021, 06:16 AM.

                            Comment

                            Working...
                            X