Use the UEF Client Object in the Fusion application window
enableUefClient is an application level variable that can be exposed in the Fusion application.
The variable is used to enable the application window to consume UEF capabilities.
You enable or disable the application variable from the Variables tab in VB Studio as shown in the following screenshot.
With variable enabled, you can use the same steps you use to access the UEF capabilities from an external application directly in application window. You can use any custom JavaScript code inside the Fusion application to access it. This feature coexists with UEF objects consumed inside external applications.
Here's a JavaScript sample added in the Fusion application container page to subscribe to TabOpen event using UEF:
UIEventsAPPFramework.UefClient.getUEFProvider().then((CX_SVC_UI_EVENTS_FRAMEWORK) => {
CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID').then((uefProvider) => {
uefProvider.getGlobalContext().then((globalContext) => {
const requestObject = uefProvider.requestHelper.createSubscriptionRequest('cxEventBusTabOpenEvent');
globalContext.subscribe(requestObject, (response) => {
console.log('Response from UEF API used in APP Window___', response);
});
});
});
});
And here's an example of Subscribe Field Value Change in the VB application window using UEF:
async listenFieldValueChange() {
const uefProvider = await UIEventsAPPFramework.UefClient.getUEFProvider();
const frameworkProvider = await uefProvider.uiEventsFramework.initialize('FVC');
const tabContext = await frameworkProvider.getTabContext();
const recordContext = await tabContext.getActiveRecord();
const requestObject =
frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusFieldValueChangeEvent');
requestObject.setFields(['ServiceRequest.Title','ServiceRequest.ProblemDescription']);
recordContext.subscribe(requestObject, (response) => {
const fieldName = response.getResponseData().getFieldName();
const newValue = response.getResponseData().getNewValue();
const oldValue = response.getResponseData().getOldValue();
console.log(`Field Name: ${fieldName}, oldValue: ${oldValue}, newValue: ${newValue}`);
});
}