Announcement

Collapse
No announcement yet.

Problems with the formula entity\addLinkMultipleId

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

  • Problems with the formula entity\addLinkMultipleId

    After upgrading to v7.4.3 (I'm not sure it this is the version when started the problem, but it was working a couple of months before), I started having the following problem.
    The following line code is giving the error 500
    entity\addLinkMultipleId('empresas', '14');

    After executing this formula, the new account is added to empresas link, that is a many to many relationship.

    The problem is that the formula flow breaks after this and the next formulas are not executed.

    Some weird things.

    When I ask to print the empresasNames, it gives null.
    When I ask to print the empresasIds, it gives error 500 and nothing is printed.

    this is the log

    Code:
    ERROR: Slim Application Error Type: TypeError Code: 0 Message: in_array(): Argument #2 ($haystack) must be of type array, null given File: /var/www/html/espocrm/application/Espo/Core/ORM/Entity.php Line: 430 Trace: #0 /var/www/html/espocrm/application/Espo/Core/ORM/Entity.php(430): in_array('14', NULL) #1 /var/www/html/espocrm/application/Espo/Core/Formula/Functions/EntityGroup/AddLinkMultipleIdType.php(62): Espo\Core\ORM\Entity->addLinkMultipleId('empresas', '14') #2 /var/www/html/espocrm/application/Espo/Core/Formula/Processor.php(113): Espo\Core\Formula\Functions\EntityGroup\AddLinkMultipleIdType->process(Object(stdClass)) #3 /var/www/html/espocrm/application/Espo/Core/Formula/Functions/BaseFunction.php(97): Espo\Core\Formula\Processor->process(Object(Espo\Core\Formula\Argument)) #4 /var/www/html/espocrm/application/Espo/Core/Formula/Functions/BundleType.php(42): Espo\Core\Formula\Functions\BaseFunction->evaluate(Object(Espo\Core\Formula\Argument)) #5 /var/www/html/espocrm/application/Espo/Core/Formula/Processor.php(116): Espo\Core\Formula\Functions\BundleType->process(Object(Espo\Core\Formula\ArgumentList)) #6 /var/www/html/espocrm/application/Espo/Core/Formula/Functions/BaseFunction.php(97): Espo\Core\Formula\Processor->process(Object(Espo\Core\Formula\Argument)) #7 /var/www/html/espocrm/application/Espo/Core/Formula/Functions/IfThenType.php(46): Espo\Core\Formula\Functions\BaseFunction->evaluate(Object(Espo\Core\Formula\Argument)) #8 /var/www/html/espocrm/application/Espo/Core/Formula/Processor.php(116): Espo\Core\Formula\Functions\IfThenType->process(Object(Espo\Core\Formula\ArgumentList)) #9 /var/www/html/espocrm/application/Espo/Core/Formula/Functions/BaseFunction.php(97): Espo\Core\Formula\Processor->process(Object(Espo\Core\Formula\Argument)) #10 /var/www/html/espocrm/application/Espo/Core/Formula/Functions/BundleType.php(42): Espo\Core\Formula\Functions\BaseFunction->evaluate(Object(Espo\Core\Formula\Argument)) #11 /var/www/html/espocrm/application/Espo/Core/Formula/Processor.php(116): Espo\Core\Formula\Functions\BundleType->process(Object(Espo\Core\Formula\ArgumentList)) #12 /var/www/html/espocrm/application/Espo/Core/Formula/Evaluator.php(86): Espo\Core\Formula\Processor->process(Object(Espo\Core\Formula\Argument)) #13 /var/www/html/espocrm/application/Espo/Core/Formula/Manager.php(60): Espo\Core\Formula\Evaluator->process('ifThen(projectN...', Object(Espo\Custom\Entities\Medicoes), Object(stdClass)) #14 /var/www/html/espocrm/application/Espo/Modules/Advanced/Core/Workflow/Actions/UpdateEntity.php(35): Espo\Core\Formula\Manager->run('ifThen(projectN...', Object(Espo\Custom\Entities\Medicoes), Object(stdClass)) #15 /var/www/html/espocrm/application/Espo/Modules/Advanced/Core/Workflow/Actions/Base.php(267): Espo\Modules\Advanced\Core\Workflow\Actions\UpdateEntity->run(Object(Espo\Custom\Entities\Medicoes), Object(stdClass)) #16 /var/www/html/espocrm/application/Espo/Modules/Advanced/Core/Workflow/ActionManager.php(72): Espo\Modules\Advanced\Core\Workflow\Actions\Base->process(Object(Espo\Custom\Entities\Medicoes), Object(stdClass), NULL, Object(stdClass)) #17 /var/www/html/espocrm/application/Espo/Modules/Advanced/Core/Workflow/ActionManager.php(43): Espo\Modules\Advanced\Core\Workflow\ActionManager->runAction(Object(stdClass), '5dfc36d11fd3540...', Object(stdClass)) #18 /var/www/html/espocrm/application/Espo/Modules/Advanced/Core/WorkflowManager.php(197): Espo\Modules\Advanced\Core\Workflow\ActionManager->runActions(Array) #19 /var/www/html/espocrm/application/Espo/Modules/Advanced/Hooks/Common/Workflow.php(48): Espo\Modules\Advanced\Core\WorkflowManager->process(Object(Espo\Custom\Entities\Medicoes), 'afterRecordSave...', Array) #20 /var/www/html/espocrm/application/Espo/Core/Hook/GeneralInvoker.php(186): Espo\Modules\Advanced\Hooks\Common\Workflow->afterSave(Object(Espo\Custom\Entities\Medicoes), Array, Array) #21 /var/www/html/espocrm/application/Espo/Core/HookManager.php(118): Espo\Core\Hook\GeneralInvoker->invoke(Object(Espo\Modules\Advanced\Hooks\Common\Workflow), 'afterSave', Object(Espo\Custom\Entities\Medicoes), Array, Array) #22 /var/www/html/espocrm/application/Espo/Core/Repositories/Database.php(320): Espo\Core\HookManager->process('Medicoes', 'afterSave', Object(Espo\Custom\Entities\Medicoes), Array) #23 /var/www/html/espocrm/application/Espo/ORM/Repository/RDBRepository.php(163): Espo\Core\Repositories\Database->afterSave(Object(Espo\Custom\Entities\Medicoes), Array) #24 /var/www/html/espocrm/application/Espo/Core/Repositories/Database.php(138): Espo\ORM\Repository\RDBRepository->save(Object(Espo\Custom\Entities\Medicoes), Array) #25 /var/www/html/espocrm/application/Espo/ORM/EntityManager.php(247): Espo\Core\Repositories\Database->save(Object(Espo\Custom\Entities\Medicoes), Array) #26 /var/www/html/espocrm/application/Espo/Tools/Formula/Service.php(105): Espo\ORM\EntityManager->saveEntity(Object(Espo\Custom\Entities\Medicoes)) #27 /var/www/html/espocrm/application/Espo/Controllers/Formula.php(85): Espo\Tools\Formula\Service->run('entity\\addLinkM...', Object(Espo\Core\Field\LinkParent)) #28 /var/www/html/espocrm/application/Espo/Core/Api/ControllerActionProcessor.php(87): Espo\Controllers\Formula->postActionRun(Object(Espo\Core\Api\RequestWrapper), Object(Espo\Core\Api\ResponseWrapper)) #29 /var/www/html/espocrm/application/Espo/Core/Api/ControllerActionHandler.php(65): Espo\Core\Api\ControllerActionProcessor->process('Formula', 'run', Object(Espo\Core\Api\RequestWrapper), Object(Espo\Core\Api\ResponseWrapper)) #30 /var/www/html/espocrm/vendor/slim/slim/Slim/MiddlewareDispatcher.php(65): Espo\Core\Api\ControllerActionHandler->handle(Object(Slim\Psr7\Request)) #31 /var/www/html/espocrm/application/Espo/Core/Api/RouteProcessor.php(222): Slim\MiddlewareDispatcher->handle(Object(Slim\Psr7\Request)) #32 /var/www/html/espocrm/application/Espo/Core/Api/RouteProcessor.php(149): Espo\Core\Api\RouteProcessor->processControllerAction(Object(Espo\Core\Api\ProcessData), Object(Slim\Psr7\Request), Object(Espo\Core\Api\ResponseWrapper)) #33 /var/www/html/espocrm/application/Espo/Core/Api/RouteProcessor.php(127): Espo\Core\Api\RouteProcessor->processAfterAuth(Object(Espo\Core\Api\ProcessData), Object(Slim\Psr7\Request), Object(Espo\Core\Api\ResponseWrapper)) #34 /var/www/html/espocrm/application/Espo/Core/Api/RouteProcessor.php(78): Espo\Core\Api\RouteProcessor->processInternal(Object(Espo\Core\Api\ProcessData), Object(Slim\Psr7\Request), Object(Espo\Core\Api\RequestWrapper), Object(Espo\Core\Api\ResponseWrapper)) #35 /var/www/html/espocrm/application/Espo/Core/Api/Starter.php(109): Espo\Core\Api\RouteProcessor->process(Object(Espo\Core\Api\ProcessData), Object(Slim\Psr7\Request), Object(Slim\Psr7\Response)) #36 /var/www/html/espocrm/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(38): Espo\Core\Api\Starter->Espo\Core\Api\{closure}(Object(Slim\Psr7\Request), Object(Slim\Psr7\Response), Array) #37 /var/www/html/espocrm/vendor/slim/slim/Slim/Routing/Route.php(358): Slim\Handlers\Strategies\RequestResponse->__invoke(Object(Closure), Object(Slim\Psr7\Request), Object(Slim\Psr7\Response), Array) #38 /var/www/html/espocrm/vendor/slim/slim/Slim/MiddlewareDispatcher.php(65): Slim\Routing\Route->handle(Object(Slim\Psr7\Request)) #39 /var/www/html/espocrm/vendor/slim/slim/Slim/MiddlewareDispatcher.php(65): Slim\MiddlewareDispatcher->handle(Object(Slim\Psr7\Request)) #40 /var/www/html/espocrm/vendor/slim/slim/Slim/Routing/Route.php(315): Slim\MiddlewareDispatcher->handle(Object(Slim\Psr7\Request)) #41 /var/www/html/espocrm/vendor/slim/slim/Slim/Routing/RouteRunner.php(68): Slim\Routing\Route->run(Object(Slim\Psr7\Request)) #42 /var/www/html/espocrm/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php(45): Slim\Routing\RouteRunner->handle(Object(Slim\Psr7\Request)) #43 /var/www/html/espocrm/vendor/slim/slim/Slim/MiddlewareDispatcher.php(121): Slim\Middleware\RoutingMiddleware->process(Object(Slim\Psr7\Request),  /var/www/html/espocrm/application/Espo/Core/Application/RunnerRunner.php(87): Espo\Core\ApplicationRunners\Api->run() #52 /var/www/html/espocrm/application/Espo/Core/Application.php(78): Espo\Core\Application\RunnerRunner->run('Espo\\Core\\Appli...', NULL) #53 /var/www/html/espocrm/public/api/v1/index.php(37): Espo\Core\Application->run('Espo\\Core\\Appli...') #54 {main} Tips: To display error details in HTTP response set "displayErrorDetails" to true in the ErrorHandler constructor.

  • #2
    can you share your formula, some other code cause this problem.

    Comment


    • #3
      If you upgraded PHP, it could be that you had the same issue before, but PHP didn't produce error (warning instead).

      Comment


      • #4
        Click image for larger version

Name:	image.png
Views:	240
Size:	60.6 KB
ID:	90941
        Click image for larger version

Name:	image.png
Views:	221
Size:	88.8 KB
ID:	90942Click image for larger version

Name:	image.png
Views:	225
Size:	112.0 KB
ID:	90943Click image for larger version

Name:	image.png
Views:	226
Size:	119.8 KB
ID:	90944Click image for larger version

Name:	image.png
Views:	221
Size:	126.2 KB
ID:	90945​​

        Comment


        • #5
          Php 8.2

          Comment


          • #6
            I could not reproduce. Maybe caused by some extension?

            Comment


            • #7
              I will recreate the entire entity, since it is giving that problem only in that one.

              Weird. Others without problems in the formula.

              Comment


              • #8
                Originally posted by yuri View Post
                I could not reproduce. Maybe caused by some extension?
                Disabled some ebla extensions I had and rebuilt the backend.
                Continues the same

                Comment


                • #9
                  yuri, Another problem arose after upgrading to version 7.4.3. Now, whenever I click on one of the records of this entity, I consistently receive an "Error 404: Not Found" message.

                  Please help me resolve this issue. Even with DEBUG enabled, the logs do not show any problems.






                  Click image for larger version

Name:	image.png
Views:	206
Size:	56.6 KB
ID:	91286

                  Comment


                  • #10
                    Originally posted by rodrigocoelho View Post
                    yuri, Another problem arose after upgrading to version 7.4.3. Now, whenever I click on one of the records of this entity, I consistently receive an "Error 404: Not Found" message.

                    Please help me resolve this issue. Even with DEBUG enabled, the logs do not show any problems.






                    Click image for larger version

Name:	image.png
Views:	206
Size:	56.6 KB
ID:	91286
                    Forget about it. Found the problem. It was using a custom field from ebla extension that I removed.
                    I would be good to have an error printed in the log.

                    thanks

                    Comment


                    • lazovic
                      lazovic commented
                      Editing a comment
                      Can you please tell me if the errors with the formula were also resolved after that?

                    • rodrigocoelho
                      rodrigocoelho commented
                      Editing a comment
                      Unfortunately not.

                  • #11
                    Originally posted by rodrigocoelho View Post
                    I would be good to have an error printed in the log.
                    It's impossible to handle anything (not saying 3rd party code) to print it to the log.

                    We spend quite a lot of time trying to figure out.

                    Comment


                    • #12
                      I already removed all 3rd party extensions. The list view works, but when trying to use the formula in sandbox, gives error.
                      ​​​​​​
                      Anyway to recreate the entire entity database without losing something?

                      Thanks

                      Comment


                      • #13
                        Found another issue.
                        Even after deleting the 'nota_fiscal_emitida_pela_metrics' field in the GUI and rebuilding the backend, it's still throwing a 500 error when attempting to create a record in the Financeiro entity. I've also removed the field from the layout.
                        yuri , there's no formula in the entity. I checked the Financeiro.json file in the custom entityDefs, and the field isn't there either. Any idea where the relationship could still be lurking after deleting the field using the GUI?

                        Maybe the errors are all related.



                        Code:
                        [2023-04-24 14:23:25] DEBUG: API (HY000) SQLSTATE[HY000]: General error: 1364 Field 'nota_fiscal_emitida_pela_metrics' doesn't have a default value; POST /Financeiro; Input data: {"name":"NF2023/XX","dataPrevistaPagamento":"2023-05-24","dataDoEnvioDaNF":"2023-04-24","valorCurrency":"BRL","valorLiquidoRecebidoC ur rency":"BRL","assignedUserId":"1","assignedUserNam e":"Rodrigo","valor":0,"confirmadoRecebimento":false,"n FCancelada":false,"medicoesName":null,"medicoesId" :null,"opportunityName":null,"opportunityId":null, "projetoName":"Estudo Dispositivos","projetoId":"6441472f6cfbfc4","description " :null,"teamsIds":[],"teamsNames":{}}; Route pattern: /{controller}; Route params: Array ( [controller] => Financeiro [action] => create )
                        [2023-04-24 14:23:25] ERROR: (HY000) SQLSTATE[HY000]: General error: 1364 Field 'nota_fiscal_emitida_pela_metrics' doesn't have a default value; POST /Financeiro; line: 76, file: /var/www/html/espocrm/application/Espo/ORM/Executor/DefaultSqlExecutor.php
                        Last edited by rodrigocoelho; 04-24-2023, 02:55 PM.

                        Comment


                        • #14
                          Originally posted by rodrigocoelho View Post
                          Found another issue.
                          Even after deleting the 'nota_fiscal_emitida_pela_metrics' field in the GUI and rebuilding the backend, it's still throwing a 500 error when attempting to create a record in the Financeiro entity. I've also removed the field from the layout.
                          yuri , there's no formula in the entity. I checked the Financeiro.json file in the custom entityDefs, and the field isn't there either. Any idea where the relationship could still be lurking after deleting the field using the GUI?

                          Maybe the errors are all related.



                          Code:
                          [2023-04-24 14:23:25] DEBUG: API (HY000) SQLSTATE[HY000]: General error: 1364 Field 'nota_fiscal_emitida_pela_metrics' doesn't have a default value; POST /Financeiro; Input data: {"name":"NF2023/XX","dataPrevistaPagamento":"2023-05-24","dataDoEnvioDaNF":"2023-04-24","valorCurrency":"BRL","valorLiquidoRecebidoC ur rency":"BRL","assignedUserId":"1","assignedUserNam e":"Rodrigo","valor":0,"confirmadoRecebimento":false,"n FCancelada":false,"medicoesName":null,"medicoesId" :null,"opportunityName":null,"opportunityId":null, "projetoName":"Estudo Dispositivos","projetoId":"6441472f6cfbfc4","description " :null,"teamsIds":[],"teamsNames":{}}; Route pattern: /{controller}; Route params: Array ( [controller] => Financeiro [action] => create )
                          [2023-04-24 14:23:25] ERROR: (HY000) SQLSTATE[HY000]: General error: 1364 Field 'nota_fiscal_emitida_pela_metrics' doesn't have a default value; POST /Financeiro; line: 76, file: /var/www/html/espocrm/application/Espo/ORM/Executor/DefaultSqlExecutor.php
                          yuri , fixed this last error doing a php command.php rebuild --hard.

                          When processing, it was giving an error, informing that a name column in the row 245 was long.

                          I had to browse the database myself and rename it manually, reducing the length (I have no idea how it was there).

                          After doing that, the rebuild --hard worked.

                          After this, the CRM is working again.
                          MAYBE this could be useful for you and other users..​

                          Comment

                          Working...
                          X