Connector: how to get several output parameters in business object

  • Klaus79
        vor 4 Jahren #23615

        Hi all,

        how do I get several output parameters from connector call in my business object.

        If the connector has only one parameter it’s straight forward, connectorCallXYZ has only a parameter value.

        Coding in business object:

        lastname = Simplifier.Connector.Attributes.connectorCallXYZ ({}).value[0].value;

         

        But what about if connectorCallXYZ has a second parameter named e.g. result (which is a collection of error messages)?

        How do I get it in business object besides the ‘value’ parameter?

        Klaus79
            vor 4 Jahren #23652
            Up
            0
            Down
            ::

            Ok guys, I did it on my own.

            If you think about it, it’s actually quite simple. I was just a level too deep.

            return = Simplifier.Connector.Attributes.connectorCallXYZ ({});

            lastname = result.value[0].value;

            message = return.result[i].messageText;

            Armin Winkler
                Has successfully completed the online course Introduction
                Has successfully completed the online course Intermediate (200)
                Has successfully completed the online course Advanced (300)
                Has successfully completed the online course Basics (100)
              vor 3 Jahren #24473
              Up
              0
              Down
              ::

              Hi Klaus,

               

              using the server-side business object API you can access the output of a connector call with the following notation: Simplifier.Connector.<ConnectorName>.<CallName>(payload?: string|object). Of course you already seem to know this. However, on top of that you can access all the parameters via the usual Javascript dot notation of an Object, as it’s this type that is returend by the already mentioned API call.

               

              Let me adapt your code snippet to make this more clear:

              lastname = Simplifier.Connector.Attributes.connectorCallXYZ({}).AliasOfParameter1;

              firstname = Simplifier.Connector.Attributes.connectorCallXYZ({}).AliasOfParameter2;

              So if you have a second parameter you can simply assign it to a second variable by accessing that key of the returned object of the connector call API. This would be exactly the same if you would query another business object instead of a connector of course. Hope this makes it even easier for you in the future. Please take note though that the keys in this object will only be meaningful if you specified an alias for each parameter in the corresponding connector call. If you did so, the keys will be the aliases that you specified.

               

              Regards,

              Armin

            Ansicht von 3 Beiträgen – 1 bis 3 (von insgesamt 3)

            You must be logged in to reply to this topic.