IServiceConnectionResponse

The response object for InvokeServiceConnection operation response.

Functions

getResponseData

Use this function to get response data for for InvokeServiceConnection operation response.

The following code sample shows the syntax for getResponseData method.

getResponseData(): IServiceConnectionResponseData;

The following code sample shows an example in typescript for subscribing to InvokeServiceConnection operation where getResponseData method is used.

/// <reference path="uiEventsFramework.d.ts"/>  
      const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');   
      const globalContext: IGlobalContext = await frameworkProvider.getGlobalContext();
       
      const restCallRequest: IServiceConnectionRequest = (frameworkProvider.requestHelper.createPublishRequest('InvokeServiceConnection') as IServiceConnectionRequest);
      restCallRequest.setServiceConnectionId('interactions/update_interactions');
      restCallRequest.setParameters({ "interactions_Id": "12345" });
      restCallRequest.setBody({ "StatusCd": "ORA_SVC_CLOSED" });
       
      globalContext.publish(restCallRequest).then((message: IServiceConnectionResponse) => {
          // custom code
           const response = message.getResponseData();
          console.log(response.getStatus());
          console.log(response.getBody());
      }).catch((error: IErrorData) => {
          // custom code
      });

The following code sample shows an example in javascript for subscribing to InvokeServiceConnection operation where getResponseData method is used.

const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');   
      const globalContext = await frameworkProvider.getGlobalContext();
       
      const restCallRequest = frameworkProvider.requestHelper.createPublishRequest('InvokeServiceConnection');
      restCallRequest.setServiceConnectionId('interactions/update_interactions');
      restCallRequest.setParameters({ "interactions_Id": "12345" });
      restCallRequest.setBody({ "StatusCd": "ORA_SVC_CLOSED" });
       
      globalContext.publish(restCallRequest).then((message) => {
          // custom code
           const response = message.getResponseData();
          console.log(response.getStatus());
          console.log(response.getBody());
      }).catch((error) => {
          // custom code
      });