Announcement

Collapse
No announcement yet.

How to stop BPM Process?

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

  • How to stop BPM Process?

    Hello,
    How to stop a BPM process when a created entity in the process (Opportunity) is deleted?
    I created Event Sub-Process with "Target: Created: Opportunity".
    As signal I try use:
    1. delete.Opportunity.id
    2. delete.Opportunity.{Id}
    3. delete.{Opportunity.id}
    4. in script :
    $ ids = opportunitiesIds;
    and then in signal:
    delete.Opportunity.{$ids}

    All 4 ways don't work. I will be grateful for any suggestion.
    Last edited by Enju; 07-01-2021, 12:03 PM.

  • #2
    Can I use $variable as id in signal?

    Comment


    • #3
      the id is already available from the target, so I would try
      Code:
      delete.Opportunity.{$id}
      EspoCRM Documentation. Contribute to espocrm/documentation development by creating an account on GitHub.

      Comment


      • Enju
        Enju commented
        Editing a comment
        Hi,
        I tried the way you suggested, but it doesn't work.

    • #4
      Is some way to stop process when entity is removed?

      Comment


      • #5
        yuri as id in signal is possible to use $variable? eg. delete.Opportunity.{$id}

        Comment


        • #6
          I tried to use Conditional Intermediate Event (Boundary) as condiions i use: deleted ==1;
          but that doesn't work either...
          Maximus
          yuri
          I can count on any suggestions on how to stop the process when the entity is removed?

          Comment


          • #7
            I raise the topic again...

            Comment


            • #8
              May be this code be helpful

              PHP Code:
              <?php

              namespace Espo\Custom\Services;

              use 
              Espo\ORM\Entity;

              class 
              Detail extends \Espo\Core\Templates\Services\Base
              {
                 protected function 
              init()
                 {
                    
              $this->addDependency('signalManager');
                 }

                 protected function 
              beforeDeleteEntity(Entity $entity)
                 {
                    
              $GLOBALS['log']->warning('Сработал афтерделет');

                    
              $signalManager $this->getInjection('signalManager');

                    
              $signalManager->trigger('deleted'$entity);

                 }

              }
              Last edited by dimyy; 07-22-2021, 12:33 PM.

              Comment


              • #9
                The global problem is that the process cannot work with the deleted entity;

                checkFlowIsActual($target, $flowNode, $process) throw error if $target is deleted;

                I suppose it's better to refuse deletion and go to status

                For example: signal delete.Detail.{$id} is working good, but intermediate signal catching event is interrupting on deleted entity
                Attached Files
                Last edited by dimyy; 07-22-2021, 01:19 PM.

                Comment

                Working...
                X