ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 6 replies, has 2 voices, and was last updated by  lapino 1 year, 11 months ago.

  • Creator
    Topic
  • #15241

    lapino
    Participant

    Hello,

    I’m integrating third party data in orocrm (integration channel) with workflow attached to entity imported.

    Is it possible to define different first workflow step depending on imported attribute value ?

    For example :
    If imported subscribed attribute value = true Then move entity workflow step to final step ‘subscribed’
    Else -> set default first workflow step

    Is this possible in workflow yml configuration ?
    Transition is only allowing one step_to.

    Maybe we can declare post action in first transition to move workflow to final step ?

    I tried to perform changes in workflow at entity event listener level but workflow was not yet assigned to entity.

    I don’t know how to solve this use case.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #15254
    ignat
    ignat
    Oro Core

    Hi lapino,

    At the moment it is not possible to have several start steps.

    You can try to follow next option. You already have a workflow with some step. Keep it as is for cases when start step is appropriate. So at this point all you need to do is move workflow item of entity to another step. It can be done via Doctrine listener. If you will use postFlush event it should work because workflow item of entity will already exist.

    Otherwise you can try to use “processes”. Here are some references: http://www.orocrm.com/documentation/index/current/user-guide/processes, https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/WorkflowBundle/Resources/doc/reference/processes/index.md.

    Process use same actions and conditions like workflow does. To cover your case you could implement process that will be triggered when entity is created. This process can change transition of workflow if some condition is true. Check this example: https://gist.github.com/ignat-s/36d844ac0cbb063edfb7.

    Thanks,
    Ignat

    #15259

    lapino
    Participant

    Hi Ignat,

    thank you for sharing complete example of process with workflow transition.
    I’ll try it now.

    I tried yet to trigger workflow transition from various listeners but not postFlush.
    Process option seems more simple to code but maybe I’ll give a try to postFlush option later.

    #15276

    lapino
    Participant

    I tried above process example ( https://gist.github.com/ignat-s/36d844ac0cbb063edfb7 ).

    This giving me an error during integration job I get this error :
    Errors were occurred:
    No Authentication Provider found for token of class “Oro\Bundle\SecurityBundle\Authentication\Token\ConsoleToken”.

    This happens when transit method is called : “$this->workflowManager->transit($workflowItem, $transition);” inside executeAction method.

    I tried to transit workflow on onFlush and postFlush listeners but this was given same “authentication” error.

    Anyone has an idea to solve this authentication problem ?

    #15300
    ignat
    ignat
    Oro Core

    Would you be able to provide respective content with this error and stack trace from your log file (app/logs/prod.log)?

    #15301
    ignat
    ignat
    Oro Core

    lapino, I was able to reproduce this issue when I tested it on workflow with transition which has option “acl_resource”. Is that your case too? If it is you can consider next options to avoid using ACL in transition:

    1) If this transition cannot be called from UI (as far as it is used only as start transition) it make sense to remove “acl_resource”.

    2) Create another transition, same as original but use option is_hidden. Then run this transition in your process. In this way your users will be able to use ACL-aware transition in UI and integration sync will use non-ACL transition.

    Thanks,
    Ignat

    #15302

    lapino
    Participant

    Hi Ignat,
    reading logs i saw that I added an acl entry in workflow transition.

    [2015-12-14 21:14:27] security.DEBUG: Check class based an access using “bga_sales_customer_create” ACL annotation.
    [2015-12-14 21:14:29] batch.ERROR: Encountered an error executing the step: No Authentication Provider found for token of class “Oro\Bundle\SecurityBundle\Authentication\Token\ConsoleToken”.

    Removing acl solved the problem.

    Thank you Ignat !

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.