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
setServiceConnectionId: (url: string) => void;
The following table shows the parameter:
Parameter Name | Required? | Description |
---|---|---|
url | Yes | URL for the service connection 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
setParameters: (parameter: any) => void;
The following table shows the parameter:
Parameter Name | Required? | Description |
---|---|---|
parameter | Yes | Parameters for the service connection in JSON format. |
/// <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
setBody: (body: any) => void;
The following table shows the parameter:
Parameter Name | Required? | Description |
---|---|---|
body | Yes | Service connection request body in JSON format. |
/// <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
});