Calling a Connector via BusinessObject

  • dcyborra
        6 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?

        Kahn
            Has successfully completed the online course Introduction
            Has successfully completed the online course Intermediate (200)
            Has successfully completed the online course Advanced (300)
          5 years ago #10034
          Up
          0
          Down
          ::

          As a user you need the permission to EXECUTE the respective Connector. The BusinessObject itself has no dedicated EXECUTION Permission for the moment. This will change in later releases though.

          r013
              5 years ago #10101
              Up
              0
              Down
              ::

              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!

            Viewing 3 posts - 1 through 3 (of 3 total)

            You must be logged in to reply to this topic.