InvokeServiceConnection Operation
Use this operation to call a service connection or REST call through the UI Events Framework.
Note: InvokeServiceConnection Operation is an operation publishable from the
GlobalContext level. Currently, only Internal Service connections marked as
extensible are supported.
Here's a TypeScript
example:
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
});
Here's a JavaScript example:
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
});