IOperationResponse
IOperationResponse is the generic response object for every operation publish request.
Functions
getOperationName
Use this function to get the operation name from the response object.
The following code sample shows the syntax for getOperationName
method.
getOperationName(): string;
The following code sample shows an example in Typescript for publishing SaveRecord
event where getOperationName method is
used.
/// <reference path="uiEventsFramework.d.ts"/>
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext: ITabContext = await frameworkProvider.getTabContext();
const recordContext: IRecordContext = await tabContext.getActiveRecord();
const requestObject: CX_SVC_UI_EVENTS_FRAMEWORK.IOperationRequest = frameworkProvider.requestHelper.createPublishRequest('cxEventBusSaveRecordOperation');
recordContext.publish(requestObject: IOperationRequest ).then((message: IOperationResponse) => {
console.log(response.getOperationName()); // usage of getOperationName
}).catch((error: IErrorData) => {
console.log(error.getMessage());
});
The following code sample shows an example in JavaScript for publishing SaveRecord
event where getOperationName method is
used.
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext = await frameworkProvider.getTabContext();
const recordContext = await tabContext.getActiveRecord();
const requestObject = frameworkProvider.requestHelper.createPublishRequest('cxEventBusSaveRecordOperation');
recordContext.publish(requestObject).then((message) => {
console.log(response.getOperationName()); // usage of getOperationName
}).catch((error) => {
console.log(error.getMessage());
});
getContext
Use this function to get the context of the response object.
The following code sample shows the syntax for getContext
method.
getContext(): IObjectContext;
The following code sample shows an example in Typescript for publishing SaveRecord
event where getContext method is
used.
/// <reference path="uiEventsFramework.d.ts"/>
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext: ITabContext = await frameworkProvider.getTabContext();
const recordContext: IRecordContext = await tabContext.getActiveRecord();
const requestObject: IOperationRequest = frameworkProvider.requestHelper.createPublishRequest('cxEventBusSaveRecordOperation');
recordContext.publish(requestObject: IOperationRequest ).then((message: IOperationResponse) => {
console.log(response.getContext()); // usage of getContext
}).catch((error: IErrorData) => {
console.log(error.getMessage());
});
The following code sample shows an example in JavaScript for publishing SaveRecord
event where getContext method is
used.
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext = await frameworkProvider.getTabContext();
const recordContext = await tabContext.getActiveRecord();
const requestObject = frameworkProvider.requestHelper.createPublishRequest('cxEventBusSaveRecordOperation');
recordContext.publish(requestObject).then((message) => {
console.log(response.getContext()); // usage of getContext
}).catch((error) => {
console.log(error.getMessage());
});