"Conditional Intermediate Event (Catching)" not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MatLudlam
    Senior Member
    • Aug 2016
    • 288

    "Conditional Intermediate Event (Catching)" not working

    Hi, I have a complex BPM that deals with processing an order. As part of that process it creates 3 tasks, 2 of which are "Pay Supplier" (number 3) and "Get Paid" (number 2). As those tasks get processed then the BPM moves on.

    The actual tasks are created in an "Event sub-process" and within that sub-process it uses a "Conditional Intermediate Event (Catching)" to check that the "Get Paid" task is complete. This works just fine.

    In the top level process near the bottom there is another "Conditional Intermediate Event (Catching)" that looks for "Pay Supplier". This never seems to fire, it just remains yellow in color when I look at the process.

    To get the process to finish I then go to the stage following the "Conditional Intermediate Event (Catching)" and pick "Start Flow From Here". This then completes the work (fields are updated and the rest of the icons go green), but the process still shows as running. Now the process has 3 different strands, all of which have an end event, and that end event has been reached for all of them.

    Here is definition of the "Conditional Intermediate Event (Catching)" that doesn't work:
    Click image for larger version

Name:	Definition.png
Views:	699
Size:	12.3 KB
ID:	57493
    The task that does work looks exactly the same except it is "Task #2" rather then "Task #3".

    This is all on the SaaS solution so happy to give you a login so that you can see if for yourselves if you want.

    Help as always appreciated.

    PS - thinking this through, there is a small chance that because I use a sub-process to create task 3, that when the second "Conditional Intermediate Event (Catching)" first runs that the task has not yet been created.
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    Hi Mat,

    Could you provide a screenshot of your flowchart or csv export so that I could import.
    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

    • yuri
      Member
      • Mar 2014
      • 8440

      #3
      The parent process doesn't know about records created inside an event sub-processes.

      But, The parent process can access records created by the regular sub-process, once the latter is completed. Meaning, once the sub-process is completed, it passes an information about created records to the parent process.

      When a sub-process is initiated it receives information about all records created by the parent process at that moment. Child-process (sub-process) can access to those records. The parent process can access records created by the sub-process only after sub-process is completed. But it doesn't work with Event Sub-Process. Those are isolated. I will review this logic more.

      I will add this to documentation.
      Last edited by yuri; 04-10-2020, 12:48 PM.
      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

      • MatLudlam
        Senior Member
        • Aug 2016
        • 288

        #4
        Thanks for the feedback, that makes sense.

        I have attached the CSV of the process (you will need to re-name it). I am not sure this is right, let me know exactly how you want it exported if this is incorrect.

        On the diagram front, please see below. The yellow highlight works, the green does not.

        Click image for larger version

Name:	Process Flow.png
Views:	761
Size:	75.8 KB
ID:	57508

        Can I suggest that if objects created in Event Sub-Processes are not visible to the parent, then when building conditions in the parent, then they should not be listed.

        Comment

        • yuri
          Member
          • Mar 2014
          • 8440

          #5
          I see you have End Error inside Event Sub Process. I believe it can't be caught. According BPMN specification an error can be caught only by a boundary event or by an event sub-process with Error Start Event inside the current process. It's not possible to attach boundary to event sub process. I could not find that it must be possible in the specification, and never saw that it was possible in other implementations of BPMN.
          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

          • yuri
            Member
            • Mar 2014
            • 8440

            #6
            As a workaround. You can throw a signal with a unique name so that it won't be caught by parallel processes. Inside the event sub-process, after conditional event, throw Signal Intermediate Event (throwing) with the signal name 'paid-task-complete-{$$processId}'. In the parent process you need to add Signal Intermediate Event (catching) instead of the conditional one, use the same signal name.

            processId is a variable name that you should define in the very beginning of the process with Script Task:

            Code:
            $processId = bpm\processEntity\attribute('id');
            Click image for larger version

Name:	w.png
Views:	791
Size:	17.5 KB
ID:	57518
            Last edited by yuri; 04-10-2020, 04:02 PM.
            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

            • MatLudlam
              Senior Member
              • Aug 2016
              • 288

              #7
              Thanks for all the help on this. As I only call the Event Sub-Process from on place I have moved this up to the parent; whilst this is the "easy way out" it also works for me.

              I have a related question though which confuses me; when I use a 'Conditional Intermediate Event (Catching)' I can check properties on new entities that I have created, say tasks. So I can check the properties of 'Created: Task #1', Created Task #2' and so on. There is also the ability to check the status of 'Created: Tasks -' with an 's' and without a number, what is this actually checking?

              I note that this is available for some entities but not all (not available for Process User Tasks).

              Thanks

              Comment

              • yuri
                Member
                • Mar 2014
                • 8440

                #8
                'Tasks' stands for relationship name. You might have 'Create Related Record' action.
                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

                • MatLudlam
                  Senior Member
                  • Aug 2016
                  • 288

                  #9
                  Sorry I have not been clear, I am using 'Conditional Intermediate Event (Catching)' and am defining what is being checked for (I cannot share a screen shot unfortunately).

                  I go into the "All" section then hit the "+" so that I can specify the field that I want to check. This lists:
                  • All of the fields on the entity
                  • Fields on related entities
                  • Fields on newly created entities
                  It is in the newly created entities that I am confused.

                  I have things like "Created: Task #1.name" along with all of the other task #1 fields. I also have the fields for "Created: Task #2", "Created: Task #3" and so on. Just before these items I have the ones that I don't understand. They are things like "Created: Tasks - Task.name" where all of the task fields are listed again; what are these?

                  I also have similar (but not exactly the same) behavior for other created entities.

                  Thanks

                  Comment

                  • yuri
                    Member
                    • Mar 2014
                    • 8440

                    #10
                    'Tasks' stands for relationship name. E.g. Account entity has link 'Tasks'. You might have 'Create Related Record' action. Or had, and it was not removed from data for some reason.
                    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

                    • MatLudlam
                      Senior Member
                      • Aug 2016
                      • 288

                      #11
                      Still confused sorry. So let's say I have an Account, which I have created 3 sub-tasks during the BPM. I can reference the tasks as task #1, task #2 and task #3, all great.

                      What happens if I reference the relationship name? What task is it referencing? There could be several tasks that existed before the BPM and the 3 new tasks.

                      Sorry for being slow.

                      Comment

                      • yuri
                        Member
                        • Mar 2014
                        • 8440

                        #12
                        Add Task element on flowchart > Add action 'Create Related Record' > Select 'Tasks'.

                        Now you have "Tasks - Task" in conditions.
                        Last edited by yuri; 04-13-2020, 11:36 AM.
                        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

                        • MatLudlam
                          Senior Member
                          • Aug 2016
                          • 288

                          #13
                          Hmm, still not there. If I create 3 tasks using what you have above (which is what I have done) I get 4 references:
                          1. Created: Task #1.*
                          2. Created: Task #2.*
                          3. Created: Task #3.*
                          4. Created: Tasks - Task.*
                          I understand what happens when I reference the first 3. If I reference "Created: Tasks - Task.name" for example, what result would I get? Which task is it referencing?

                          Comment

                          Working...