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
s ensBS = ##class(Ens.BusinessService).%New()
s requestObj.operationDate="2024-02-28"
s requestObj.provider="Provider"
s requestObj.processId=$SYSTEM.Util.CreateGUID()
d ensBS.SendRequestAsync("process.ReconciliationPayments",requestObj, "payment")
q sc
}
Comments
Something like this:
set status = ##class(Ens.Director).CreateBusinessService("My.BusinessService", .instance)
set status = instance.SendRequestAsync("My.BusinessProcess", request, .response)set status = instance.SendRequestAsync("My.BusinessProcess", request, .response)
Getting error <INVALID OREF>
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.
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().
You are right! I copied the call to the BS from the Token message without review it.
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)Thank you!