Calling a Connector via BusinessObject
-
KahnModerator
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
Has successfully completed the online course Advanced (300)7 years, 1 month ago #10101::Hello dcyborra,
afaik there are two ways to use Connector-calls in BusinessObjects
the first (old one) would be:
CONNECTOR_<Connector-Name>.runCall(<ConnectorCallName>, <Payload>);in which your Payload – if you need a input parameter in terms of a payload – of the ConnectorCall – has to be a stringified Object.
Example:
Let’s say there is a Connector called User , which has a function ( Connector-Call ) “getDataFromUsername” to get all data-sets based on a username as input-parameter . Your goal is to save the data returned from the connector call in a variable.
The solution would be:
var lo_result = CONNECTOR_User.runCall("getDataFromUsername", JSON.stringify(lo_payload));Where the format of
lo_payloadhas to be:var lo_payload = { /* if the BusinessObject uses an input-parameter called username, * "john.doe" would be replaced with input.username */ "username" : "john.doe" }since the input-parameter of the ConnectorCall is called “username”.
The second and newer solution would be:
Simplifier.Connector.<ConnectorName>.<CallName>(payload?: string|object): objectThis version is the easier of both, because the payload hasn’t to be stringified since the method can handle strings as well as objects and returns an object.
With respect to our example, the solution would be:
var lo_result = Simplifier.Connector.User.getDataFromUsername(lo_payload);the format of
lo_payloadstays the same.Hopefully this answer was helpful!
cheers!
You must be logged in to reply to this topic.