Neerav Adam Verma · Oct 19, 2019

Best way to programatically call a Business Process from Code



We can easily do a <call> from graphic BPL's


I was wondering what is the best way we can call another Business Process or Operation via code.

Thanks in advance

0 753
Discussion (6)3
Log in or sign up to continue

From a business host you would use the ..SendRequestSync or ..SendRequestAsync method call.

From outside of a business host you could create a business service that took a target configname and a request message as input and use the CreateBusinessService method in End.Director to iinstanciate and call it 

Yes but I do not want to make all calls via Business Service.
How we do in graphic bpls , as many calls as we want . Thats what I want to achieve


I'm not sure that you can.   From within a production you can call from one host to another, e.g. bs->bp, bs->bo, bp->bp, bp->bo, bo->bp, bo->bo, etc.

From outside the production you cant really call a bp or a bo directly.

Why do you not want to setup a bs that can route your call to whatever bp or bo you want?

Hey Marc,

I agree Business Service is  a standard approach and that's what I would have used too when needed. 

And as you pointed it shows a request going from Service and it works if we call it from CSP , ZEN etc

What I am trying to achieve is an exact functionality from custom bpl code as we do from a graphic bpl.  
Lets say for ex
my bpl takes x ,y as request properties
calls an op to sum them and return the result in response
stores the result in z
passes the z to a second op to send to some system.

Now in a graphic bpl this is straight forward 2 step work, I just wanted to know how to do it in custom code.

The exact traces etc as we would see via graphic bpl.  

From a custom ObjectScript Business Process, you would use ..SendRequestSync or ..SendRequestAsync to make calls to other components. These will do the same thing as <CALL> in a BPL.

Neerav, I'll just note that if you use Jenna's suggestion your code doesn't need to be a part of a business service -- it can be any normal ObjectScript code and can be called from anywhere (CSP, scheduled task, etc.). And your code can make as many calls as it needs to and can receive response messages.

It will appear in message traces as if a business service sent requests to the process or operation, but in reality it's just your code sending the requests.

Jenna's approach is a good one, and it's the standard way to achieve what you describe. Having said that, if you can provide more details on your use case and/or why this approach doesn't fit your need we can help you explore alternatives.