Calling a Connector via BusinessObject
-
dcyborra6 years ago #9949
Hi,
when I am working with BusinessObjects, how do I call a Connector from inside a BusinessObject? Does the user need permission for both, the BusinessObject and Connector?
KahnHas successfully completed the online course IntroductionHas successfully completed the online course Intermediate (200)Has successfully completed the online course Advanced (300)r0135 years 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_payload
has 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): object
This 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_payload
stays the same.Hopefully this answer was helpful!
cheers!
You must be logged in to reply to this topic.