After the update does not work Service Action

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

    After the update does not work Service Action

    Hello!
    After updating Espo and the Module, this workflow stopped working normally. How to fix it? Because of what is it? Before the upgrade, it worked.
    I have a lot of worker threads working on the basis of Service Action.

    PHP Code:
    <?php
    
    namespace Espo\Custom\Services;
    use \Espo\ORM\Entity;
    class SetRelationFeld extends \Espo\Core\Services\Base
    {
        public function setRelationFeldAction($workflowId, Entity $entity, array $additionalParameters = null)
        {        
                $opportunity = $this->getEntityManager()->getEntity($entity->get('parentType'), $entity->get('parentId'));
    
    
                $saveStage = $opportunity->get('stage');
                $arrayStage = array("New" ,"Diagnostics","Repairs","Searchdetails","CoordinationClient","WaitPrePaid","PurchaseDetails");
                if (in_array($saveStage,$arrayStage)){
    
    
    
    
                    $stage = "Waiting Parts";
                    if ($opportunity) {
                            $opportunity->set(array('stage'=>$stage));
                            $this->getEntityManager()->saveEntity($opportunity, array('skipWorkflow' => true));
                    }
                }
        }
    }
    ?> 
    
    Click image for larger version

Name:	OnPaste.20180117-010149.png
Views:	532
Size:	4.4 KB
ID:	33871
    Attached Files
    Last edited by mr2d2; 01-19-2018, 10:10 AM.
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    Hi,

    Try to to remove array type hint `public function setRelationFeldAction($workflowId, Entity $entity, $additionalParameters = null)`
    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
      >
      PHP Code:
       public function setRelationFeldAction($workflowId, Entity $entity, $additionalParameters = null) 
      
      the problem did not dare.
      Last edited by mr2d2; 01-19-2018, 10:08 AM.

      Comment

      • tanya
        Senior Member
        • Jun 2014
        • 4308

        #4
        public function setRelationFeldAction($workflowId, Entity $entity, array $additionalParameters = null) - current (doesn't work)
        public function setRelationFeldAction($workflowId, Entity $entity, $additionalParameters = null) - has to be

        for now $additionalParameters could be null or an object.

        Comment

        • mr2d2
          Senior Member
          • Apr 2017
          • 126

          #5
          Originally posted by tanya
          public function setRelationFeldAction($workflowId, Entity $entity, array $additionalParameters = null) - current (doesn't work)
          public function setRelationFeldAction($workflowId, Entity $entity, $additionalParameters = null) - has to be

          for now $additionalParameters could be null or an object.
          the problem did not dare.

          Comment

          • tanya
            Senior Member
            • Jun 2014
            • 4308

            #6
            Bad server response - what do you see in espo log?

            Comment

            • mr2d2
              Senior Member
              • Apr 2017
              • 126

              #7
              Originally posted by tanya
              Bad server response - what do you see in espo log?
              Share your pictures, send large videos, exchange music or transfer big files. No registration required. Unlimited upload/download speed.

              log file

              Comment

              • tanya
                Senior Member
                • Jun 2014
                • 4308

                #8

                [2018-01-19 10:42:12] Espo.ERROR: Workflow [Utils::getFieldValue]: The related field [assignedUser.roles] entity [Opportunity] has unsupported instance [NULL]. [] []
                [2018-01-19 10:42:12] Espo.WARNING: E_WARNING: in_array() expects parameter 2 to be array, null given {"code":2,"message":"in_array() expects parameter 2 to be array, null given","file":"/var/www/u0334546/public_html/crm-crm.ru/application/Espo/Modules/Advanced/Core/Workflow/Conditions/Has.php","line":33,"context":{"fieldValue":null,"s ubjectValue":"5a43ea8853b6e1c54"}} []
                [2018-01-19 10:42:12] Espo.ERROR: Workflow [Utils::getFieldValue]: The related field [assignedUser.roles] entity [Opportunity] has unsupported instance [NULL]. [] []
                [2018-01-19 10:42:12] Espo.WARNING: E_WARNING: in_array() expects parameter 2 to be array, null given {"code":2,"message":"in_array() expects parameter 2 to be array, null given","file":"/var/www/u0334546/public_html/crm-crm.ru/application/Espo/Modules/Advanced/Core/Workflow/Conditions/Has.php","line":33,"context":{"fieldValue":null,"s ubjectValue":"58320dc29222d8cc5"}} []


                The problem is not related with service, but only with a workflow.
                Could you share with me a screenshot of your workflow and the record in database (table workflow, find the needed by ID)
                also what is your current version of EspoCRM and Advanced Pack?
                Last edited by yuri; 01-21-2018, 07:24 AM.

                Comment

                • mr2d2
                  Senior Member
                  • Apr 2017
                  • 126

                  #9
                  Sorry for scrolling.
                  My version of Advanced Pack 1.28.7
                  EspoCRM version 5.0.2


                  Click image for larger version  Name:	OnPaste.20180119-211516.png Views:	1 Size:	44.7 KB ID:	33889
                  workflow

                  the record in database http://dropmefiles.com/yK1kt
                  Last edited by mr2d2; 01-19-2018, 06:59 PM.

                  Comment

                  • mr2d2
                    Senior Member
                    • Apr 2017
                    • 126

                    #10
                    tanya, how to fix it?

                    Comment


                    • yuri
                      yuri commented
                      Editing a comment
                      Saturday and Sunday are days off.
                  • tarasm
                    Super Moderator
                    • Mar 2014
                    • 573

                    #11
                    Tested on EspoCRM 5.0.3 with Advanced Pack 1.28.8. For me it works well.
                    Try to find the problem with a debug mode, https://www.espocrm.com/documentatio...debugging-mode.
                    Job Offers and Requests

                    Comment

                    Working...