OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – How do I? Questions Add specific API call (GET) on WorkFlow

This topic contains 9 replies, has 4 voices, and was last updated by  KnutFr 8 years, 4 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #28577

    KnutFr
    Participant

    Hi,

    I would like to know is it possible to add some specific call (like script or API call) in workflow ?
    For example in my Workflow I would like to call http://localhost/myApiCall which return UserId list for marketing mailing.

    Thanks a lot.
    KnutFR

Viewing 9 replies - 1 through 9 (of 9 total)
  • Author
    Replies
  • #28578

    adrienpit
    Participant

    Hi,

    Same question for me, is it possible ?

    Thanks

    #28579

    Dima Soroka
    Keymaster

    Yes, this is possible with custom actions in workflow definition.

    #28580

    KnutFr
    Participant

    Hi,

    Thanks for your advice, I would like to know if you have a complete example of custom workflow implementation. In my case, I have declared a service and a matching controller which call my script.

    After this step, how can I add this transition in a new/existing workflow?

    Do I have to create whole workflow as a services ?

    Thanks,

    KnutFr

    #28581

    Yevhen Shyshkin
    Participant

    Hello, KnutFr.

    > I would like to know if you have a complete example of custom workflow implementation.
    Not sure what you mean by example of custom workflow implementation. Every workflow has it’s definition – you can change it in code, you can create new one etc.

    > In my case, I have declared a service and a matching controller which call my script.
    Well, it usually better to define actions without controller actions (example). In case you still need to use it – you should handle it as sub request.

    > After this step, how can I add this transition in a new/existing workflow?
    You need either create new workflow or clone existing one, and then add new transition with your action there (here is simple transition and transition definition examples).

    > Do I have to create whole workflow as a services ?
    Well, workflow is not defined as service – workflow is an object that created in runtime based on workflow definition. Usually you need to define worklfow action as a service with special tag and unique alias/action name (example).

    If you still have some workflow related questions – feel free to post them here.

    #28582

    KnutFr
    Participant

    Hi,

    I have implemented a process which sending some mail from defined template :

    But when this process is executed, i have the following error message:

    Do I have forget something in my action declaration ?
    Maybe something is missing in template owner’s profile ?

    Thanks a lot,
    KnutFr

    #28583

    Yevhen Shyshkin
    Participant

    Look’s like CRM can’t find an entity with email contac@egswcn.com – there should be an author for this email (e.g. User entity). Please, try to register user with this email and check again.

    #28584

    KnutFr
    Participant

    Hi,

    Just asking a final question and I think that my process will be complete !
    I have a cron call (oro:cron:checkprocess) which alter some record on a custom entity.
    I have also created a process, triggered on update on those records (from custom entity) but when my cron job is executed and DB alterated, the trigger doesn’t launch my process.

    Am I doing something wrong ?
    Is it possible to directly call a process at the end of execute() cron job method ?

    Again thanks a lot !
    KnutFr

    #28585

    Yevhen Shyshkin
    Participant

    To make process executed following conditions must be satisfied:
    – process definition is active
    – process trigger listens to changing of entity field (specific or any field)
    – entity field was changed (i.e. defined in entity changeset)

    What might be wrong in your case:
    – process definition is disabled or doesn’t listen to correct event/field
    – you changing field of related entity, not root entity; e.g. you have contact related to your custom entity, and you are changing contact first name – in this case process for custom entity will not be executed

    To find out why your process is not executed you should try to do some actions from UI (make sure process is executed) and check changeset used at UI, and then do the same from CLI – probably, you should see the difference.

    > Is it possible to directly call a process at the end of execute() cron job method ?
    Yes, it’s possible, but not recommended. You can manually run methods handleTrigger and finishTrigger (and maybe including isTriggerApplicable) from ProcessHandler. To understand how they work see ProcessCollectorListener and ExecuteProcessJobCommand classes.

    #28586

    KnutFr
    Participant

    The problem was my code, in fact in my process I modified the field without Entity Manager, when I’m using it everything works fine !

    Again thank you a lot !

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

The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.

Back to top