Question Token Ibragimov · Feb 28, 2024

How call a Business Process from method

Hello!

How I can call my Business process - "process.ReconciliationPayments" from method. Like this.

ClassMethod getReportPavlodarEnergoSbyt()
{

s sc = $$$OK

ensBS = ##class(Ens.BusinessService).%New()

requestObj.operationDate="2024-02-28"
requestObj.provider="Provider"
requestObj.processId=$SYSTEM.Util.CreateGUID()

ensBS.SendRequestAsync("process.ReconciliationPayments",requestObj"payment")

q sc

}

Product version: Caché 2016.1
$ZV: Cache for Windows (x86-64) 2016.1.1 (Build 108U) Wed Jul 6 2016 15:57:04 EDT

Comments

Luis Angel Pérez Ramos · Feb 28, 2024

Something like this:

set status = ##class(Ens.Director).CreateBusinessService("My.BusinessService", .instance)
set status = instance.SendRequestAsync("My.BusinessProcess", request, .response)
0
Token Ibragimov  Feb 28, 2024 to Luis Angel Pérez Ramos

set status = instance.SendRequestAsync("My.BusinessProcess", request, .response)

Getting error <INVALID OREF>

0
Luis Angel Pérez Ramos  Feb 28, 2024 to Token Ibragimov

Hi Token! You need an interoperability production running with a business component with the same name that you are using to invoke it. The production has to be running on the same namespace.

0
Enrico Parisi  Feb 28, 2024 to Luis Angel Pérez Ramos

Hi Luis, I've never used a BS witout the usual ProcessInput() call, anyway, from a BS you cannot call SendRequestAsync() with a response. If you need a response in a BS then you must call SendRequestSync().

0
Luis Angel Pérez Ramos  Feb 28, 2024 to Enrico Parisi

You are right! I copied the call to the BS from the Token message without review it.

0
Enrico Parisi · Feb 28, 2024

A Business Process can only be invoked/called from a Business Service within an Interoperability Production.

You can invoke/call a Business service from your code/application with:

Set sc = ##class(Ens.Director).CreateBusinessService("BusinessServiceName", .BService)
If$$$ISERR(sc) ; handle error hereSet sc = BService.ProcessInput(BSRequest,.BSResponse)
0