Condition in the workflow

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mr2d2
    Senior Member
    • Apr 2017
    • 126

    Condition in the workflow

    Hello
    How can I implement a check in the workflow for the number of Opportuity Activities associated with it.
    Example:
    If all Activities related to Opportunity have stage "close", then execute my code.
    Click image for larger version  Name:	image_0127911632 (1).png Views:	1 Size:	72.8 KB ID:	32726
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    Hi,

    Needs coding. You need to create a formula function. See https://www.espocrm.com/documentatio...on-in-formula/
    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

    • mr2d2
      Senior Member
      • Apr 2017
      • 126

      #3
      Originally posted by yurikuzn
      Hi,

      Needs coding. You need to create a formula function. See https://www.espocrm.com/documentatio...on-in-formula/
      Thanks for the answer, but I think it will be easier for me to implement this using the "Service Action".
      Tell me please how to get Activities related to Opportunity?

      Comment

      • mr2d2
        Senior Member
        • Apr 2017
        • 126

        #4
        I tried to do this, but my code does not work
        PHP Code:
        $dostavki = $this->getEntityManager()->getEntity('Dostavki', $entity->get('Id'));
                      $opportunity = $this->getEntityManager()->getEntity($entity->get('parentType'), $entity->get('parentId'));
                      $parentType = $entity->get('parentType');
                      $parentName = $this->get('parentName');
                      $parentId = $entity->get('parentId'); 
        
        I tried to find all the entity with a certain variable "Parent"
        PHP Code:
        $Dostavkilist = $entityManager->getRepository('Dostavki')->where(array(
            'parentName' => $parentName, 'parentId' => $parentId  ))->find(); 
        
        Help me please

        Comment

        • tanya
          Senior Member
          • Jun 2014
          • 4308

          #5
          Hello
          Use for searching parentType instead of parentName

          Comment

          • mr2d2
            Senior Member
            • Apr 2017
            • 126

            #6
            It works!
            Thank!
            Last edited by mr2d2; 11-28-2017, 10:23 AM.

            Comment

            Working...