Subscribe Custom Event on RecordContext
All the Agent info functions will work with Tab Context.
The following code sample shows an example in TypeScript for getting agent's first name
using getFirstName
method using tab context of given tab Id.
/// <reference path="uiEventsFramework.d.ts"/> const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID','V1');
const tabContext: ITabContext = await frameworkProvider.getCurrentBrowserTabContext('tabId');
const requestObject: IOperationRequest = frameworkProvider.requestHelper.createPublishRequest('GetAgentInfo') as CX_SVC_UI_EVENTS_FRAMEWORK.IOperationRequest;
tabContext.publish(requestObject).then((message: IOperationResponse) => {
const response: IGetAgentInfoResponse = message as IGetAgentInfoResponse;
console.log(response.getFirstName()); // usage of getFirstName
});
The following code sample shows an example in JavaScript for getting agent's first name
using the getFirstName
method.
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''V1');
const tabContext = await frameworkProvider.getCurrentBrowserTabContext('tabId');
const requestObject = frameworkProvider.requestHelper.createPublishRequest('GetAgentInfo'); tabContext.publish(requestObject).then((response) => {
console.log(response.getFirstName());
});