ssossossossosso

Forums

Forums OroPlatform OroPlatform – How do I? Questions How to run custom complex operations after workflow transition?

This topic contains 2 replies, has 2 voices, and was last updated by  Stepan Yudin 2 years, 3 months ago.

  • Creator
    Topic
  • #30449

    Stepan Yudin
    Participant

    Good day everyone!

    I still can’t figure out the correct approach to handle complex operations at workflow transition.
    In fact, i need to pass current entity to some service when workflow step was changed

    I know about post_actions configuration but this feature allow to execute simple actions like find some entity and set relation with it.
    In my case i need to run really complex calculations (i need to calculate paid shipping for financial quarters)
    Can you give me advice, please


    Docker environment for Symfony2/OroCRM/OroBAP development on Windows platform
    https://github.com/stepansib/sf-oro-docker

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #30450

    Yevhen Shyshkin
    Participant

    Hello, Stepan.

    You should create your custom action, encapsulate all complex calculations inside it and run it in required post actions.

    How to do that:
    1) create action class that extends AbstractAction or implements ActionInterface (example)
    2) register this action in DI with oro_workflow.action tag and some unique alias that defines action name (example)
    3) put your action in init actions or post actions (example)
    4) reload worklfow configuration using CLI command oro:workflow:definitions:load

    #30451

    Stepan Yudin
    Participant

    Yevhen, thats it! Thanks, you saved a lot of my time! )


    Docker environment for Symfony2/OroCRM/OroBAP development on Windows platform
    https://github.com/stepansib/sf-oro-docker

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

You must be logged in to reply to this topic.