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.
- CreatorTopic
- November 4, 2015 at 7:43 am #28577
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 - CreatorTopic
- AuthorReplies
- November 10, 2015 at 2:08 am #28578
Hi,
Same question for me, is it possible ?
Thanks
November 10, 2015 at 1:37 pm #28579Yes, this is possible with custom actions in workflow definition.
November 11, 2015 at 9:25 am #28580Hi,
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
November 16, 2015 at 2:21 am #28581Hello, 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.
November 26, 2015 at 8:57 am #28582Hi,
I have implemented a process which sending some mail from defined template :
123456actions:- @send_email_template:from: 'contac@egswcn.com'to: $.lead.contact_id.emailtemplate: 'bmw_template'entity: $.leadBut when this process is executed, i have the following error message:
12345[ErrorException]Catchable Fatal Error: Argument 3 passed to Oro\Bundle\EmailBundle\Mailer\Processor::createEmailUser() must be an instance of Oro\Bundle\EmailBundle\Entity\EmailOrigin, null given, called in /home/sites/crm/vendor/oro/platform/src/Oro/Bundle/EmailBundle/Mailer/Processor.php on line 152 and defined in /home/sites/crm/vendor/oro/platform/src/Oro/Bundle/EmailBundle/Mailer/Processor.php on line 189oro:process:execute:job [--id ID] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-s|--shell] [--process-isolation] [-e|--env ENV] [--no-debug] [--jms-job-id JMS-JOB-ID] [--disabled-listeners DISABLED-LISTENERS] [--] <command>Do I have forget something in my action declaration ?
Maybe something is missing in template owner’s profile ?Thanks a lot,
KnutFrNovember 26, 2015 at 9:29 am #28583Look’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.
November 29, 2015 at 9:44 am #28584Hi,
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 !
KnutFrNovember 30, 2015 at 1:46 am #28585To 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 executedTo 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.November 30, 2015 at 10:19 am #28586The 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 !
- AuthorReplies
The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.