Skip to main content
Solved

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

  • August 13, 2024
  • 9 replies
  • 325 views

dsj
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Ultimate Hero (Partner)
  • 861 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)
  • 266 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)
  • 121 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)
  • 861 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)
  • 861 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)
  • 861 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)
  • 861 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