IServiceConnectionRequest

The UI Events Framework supports all Service connection requests listed in the Service tab of the Fusion Application.

The IServiceConnectionRequest object must be passed as the request information for InvokeServiceConnection operation publish API.

Functions

setServiceConnectionId

The following example shows the syntax for setServiceConnectionId function for IServiceConnectionRequest object.
setServiceConnectionId: (url: string) => void;

The following table shows the parameter:

Parameters

Parameter Name Required? Description
url Yes URL for the service connection request.
The following code snippet shows an example in Typescript where setServiceConnectionId function is used for making an InvokeServiceConnection request:
/// <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: IOperationResponse) => {
           // custom code
           const response = (message as IServiceConnectionResponse).getResponseData();
           console.log(response.getStatus());
           console.log(response.getBody());
      }).catch((error: IErrorData) => {
           // custom code
      });

The following code snippet shows an example in JavaScript where setServiceConnectionId function is used for making an InvokeServiceConnection request:

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('contacts/getall_contacts');
      
      globalContext.publish(restCallRequest).then((message) => {
          // custom code
      }).catch((error) => {
          // custom code
      });

setParameters

The following example shows the syntax for setServiceConnectionId function for IServiceConnectionRequest object.
setParameters: (parameter: any) => void;

The following table shows the parameter:

Parameters

Parameter Name Required? Description
parameter Yes Parameters for the service connection in JSON format.
The following code snippet shows an example in Typescript where setParameters function is used for making an InvokeServiceConnection request:
/// <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('contacts/getall_contacts');
      restCallRequest.setParameters({ 'fields': 'ContactName,MobileNumber,PartyNumber', 'q': 'MobileNumber=12345' });
      
      globalContext.publish(restCallRequest).then((message: IOperationResponse) => {
          // custom code
      }).catch((error: IErrorData) => {
          // custom code
      });
      

The following code snippet shows an example in JavaScript where setParameters function is used for making an InvokeServiceConnection request:

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('contacts/getall_contacts');
      restCallRequest.setParameters({'fields': 'ContactName,MobileNumber,PartyNumber', 'q': 'MobileNumber=12345' });
      
      globalContext.publish(restCallRequest).then((message) => {
          // custom code
      }).catch((error) => {
          // custom code
      });

setBody

The following example shows the syntax forsetBody function for IServiceConnectionRequest object.
setBody: (body: any) => void;

The following table shows the parameter:

Parameters

Parameter Name Required? Description
body Yes Service connection request body in JSON format.
The following code snippet shows an example in Typescript where setBody function is used for making an InvokeServiceConnection request:
/// <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: IOperationResponse) => {
           // custom code
      }).catch((error: IErrorData) => {
           // custom code
      });
      

The following code snippet shows an example in JavaScript where setBody function is used for making an InvokeServiceConnection request:

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
      }).catch((error) => {
          // custom code
      });