Skip to main content
Solved

Is it possible to execute a different workflow inside a workflow?

  • August 13, 2024
  • 9 replies
  • 337 views

dsj
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Ultimate Hero (Partner)
  • 866 replies

Hi All,

 

We have a requirement of creating dozens of workflows which need to send data to a single API endpoint.

This would need hardcoding the authentication details, endpoint URL in each of the workflows.

It would be much easier if we were to write one workflow for sending data to the API and call that from the other workflows. Is this possible?

 

Regards,

Damith

Best answer by dsj

Hi โ€‹@paul harland 

Yes, I found it and overjoyed by the potential of this ๐Ÿ˜Ž Check this blog post where I wrote some steps  to do that.

https://dsj23.me/2024/09/04/start-ifs-cloud-workflow-using-rest-api/

 

Cheers!

Damith

View original
Did this topic help you find an answer to your question?

9 replies

Forum|alt.badge.img+12
  • Hero (Customer)
  • 272 replies
  • August 13, 2024

From a pure BPMN Standpoint, I suggest you have at  look at this:

 

https://docs.camunda.io/docs/components/modeler/bpmn/call-activities/

 

 

I donโ€™t know if itโ€™s viable within IFS, but it might be worth a try. Effectively having one bpmn calling another one seems to be what youโ€™re trying to achieve, and there seems to be ways to parse variable data to them

 

 

I assume the called element would be your โ€œAPI Callโ€ workflow, although Iโ€™m not sure how to retrieve the Tenant ID (or if itโ€™s even mandatory) or whether to use Business Key or not etc. havenโ€™t read through the documentation in depth

 

The binding is useful as well as it seems you can bind to the deployment version of the called workflow too, so when you have multiple versions of the same workflow you can be sure to only ever call the deployed one


wahelk
Hero (Former Employee)
Forum|alt.badge.img+11
  • Hero (Former Employee)
  • 123 replies
  • August 13, 2024

If I can remember call another workflow from a workflow is not supported.


Lahirumala de Mel
Hero (Employee)
Forum|alt.badge.img+7

Call activity will not work in IFS set up. But you may use a REST task and invoke the other Workflow using a URL like this

https://<host_name>/main/ifsapplications/projection/engine-rest/process-definition/key/<Process_key>/start

But note that the 2nd Workflow will not be continued in the same transaction but a new transaction will initiate for it.


dsj
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Author
  • Ultimate Hero (Partner)
  • 866 replies
  • August 15, 2024
Lahirumala de Mel wrote:

Call activity will not work in IFS set up. But you may use a REST task and invoke the other Workflow using a URL like this

https://<host_name>/main/ifsapplications/projection/engine-rest/process-definition/key/<Process_key>/start

But note that the 2nd Workflow will not be continued in the same transaction but a new transaction will initiate for it.

 

Hi @Lahirumala de Mel 

Thanks for the clarification. This is really interesting!

Whatโ€™s the format of the json payload for the call? Is it the same json format which is in the watch observation value?


Forum|alt.badge.img
  • Do Gooder (Customer)
  • 1 reply
  • October 16, 2024

Iโ€™m also very keen to find a solution to this problem. Weโ€™d like to have one workflow that does OAuth2 authentication that can be used by other workflows.

@Lahirumala de Mel By starting the workflow via an external API call weโ€™re just as far. We still have to update each and every workflow with OAuth2 credentials for the IFS API. 

Iโ€™ve tried searching for a projection to start a workflow, but havenโ€™t found one yet.

@dsj 

Iโ€™m using the following request to start a workflow and it returns the AccessToken

https:///<host>/ifsapplications/projection/engine-rest/process-definition/<key>/start

Body:

{
  "withVariablesInReturn": true
}

Have anyone found a solution for this yet? Either via workflow-to-workflow or a call activity?


dsj
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Author
  • Ultimate Hero (Partner)
  • 866 replies
  • October 22, 2024

Hi @tleirvik 

 

Iโ€™ve found in IFS defined workflows such as finCurrencyTypeUpdate, it uses a dummy projection action as the workflow trigger.

CurrencyRatesHandling.UpdateCurrencyRatesFromWorkFlow()

 

Workflow finUpdateCurrencyRatesForCurrencyTask is designed so that it will call the above projection action, which will trigger the finCurrencyTypeUpdate workflow.

 

By this way, you can call one workflow from another, but Iโ€™m not sure itโ€™s the only way.

Itโ€™s cool that we can get the return values from a workflow. I need to give a try ๐Ÿ˜Ž

/Damith

 

 


paul harland
Superhero (Employee)
Forum|alt.badge.img+24

โ€‹@dsj 

Not sure if youโ€™re still looking for the payload format here.  This seems to work:

Rest endpoint  (BPA key highlighted)

https://xxxxx.ifs.cloud/main/ifsapplications/projection/engine-rest/process-definition/key/zTestonly/start?odata-debug=json

Payload format:    {"variables":{"MyDate":{"value":"&NEW:WORK_START","type":"String"},"MyTaskNum":{"value":"&NEW:TASK_SEQ","type":"String"}}}


dsj
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Author
  • Ultimate Hero (Partner)
  • 866 replies
  • Answer
  • November 27, 2024

Hi โ€‹@paul harland 

Yes, I found it and overjoyed by the potential of this ๐Ÿ˜Ž Check this blog post where I wrote some steps  to do that.

https://dsj23.me/2024/09/04/start-ifs-cloud-workflow-using-rest-api/

 

Cheers!

Damith


dsj
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Author
  • Ultimate Hero (Partner)
  • 866 replies
  • April 10, 2025
dsj wrote:

Hi โ€‹@paul harland 

Yes, I found it and overjoyed by the potential of this ๐Ÿ˜Ž Check this blog post where I wrote some steps  to do that.

https://dsj23.me/2024/09/04/start-ifs-cloud-workflow-using-rest-api/

 

Cheers!

Damith

 

Making this as the best answer since the workaround with calling a second workflow using restapi seems to work pretty fine :)


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings