IEngagementContext

EngagementContext is the object that encapsulates the tabContext in which the new call connection has been established because of a startCommEvent publish request. As a result, you can get control over the objects being opened by that call connection.

Here's the syntax:
getEngagementContext(): IEngagementContext;

The following is a code sample in Typescript.

const uiEventsFrameworkInstance: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
const multiChannelAdaptorContext: IMultiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
const phoneContext: IPhoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE') as IPhoneContext;
const request: IMcaStartCommEventActionRequest = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent') as IMcaStartCommEventActionRequest;
 //You should set correct appClassification here. eg: ORA_SERVICE for Service App
 // Refer https://docs.oracle.com/en/cloud/saas/fusion-service/fairs/application-classification-code.html#s20059918 for the list of supported app classifications
request.setAppClassification('appClassfication');
request.setEventId('1'); // Set the event ID here
const inData: IMcaStartCommInDataRequest = request.getInData();
phoneContext.publish(request).then((res: IOperationResponse) => {
    const response: IMcaStartComActionResponse = res as IMcaStartComActionResponse;
    const startCommData: IMcaStartComActionData = response.getResponseData();
    const engagementContext: IEngagementContext = startCommData.getEngagementContext();
})
The following is a code sample in Javascript.
const uiEventsFrameworkInstance = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
  const multiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
  const phoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE');
  const request = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent');
  //You should set correct appClassification here. eg: ORA_SERVICE for Service App
  // Refer https://docs.oracle.com/en/cloud/saas/fusion-service/fairs/application-classification-code.html#s20059918 for the list of supported app classifications
  request.setAppClassification('appClassfication');
  request.setEventId('1'); // Set the event ID here
  const inData = request.getInData();
  phoneContext.publish(request).then((response) => {
      const startCommData = response.getResponseData();
      const engagementContext = startCommData.getEngagementContext();
  })

Functions

getEngagementId

Use this function to get the unique identifier of the engagement object opened because of a new call connection

The following sample shows the syntax:
getEngagementId(): string; 
The following is a code sample in Typescript.
/// <reference path="uiEventsFramework.d.ts"/> 
  const uiEventsFrameworkInstance: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
  const multiChannelAdaptorContext: IMultiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
  const phoneContext: IPhoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE') as IPhoneContext;
  const request: IMcaStartCommEventActionRequest = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent') as IMcaStartCommEventActionRequest;
  //You should set correct appClassification here. eg: ORA_SERVICE for Service App
  // Refer https://docs.oracle.com/en/cloud/saas/fusion-service/fairs/application-classification-code.html#s20059918 for the list of supported app classifications
  request.setAppClassification('appClassfication');
  request.setEventId('1'); // Set the event ID here
  const inData: IMcaStartCommInDataRequest = request.getInData();
  phoneContext.publish(request).then((res: IOperationResponse) => {
      const response: IMcaStartComActionResponse = res as IMcaStartComActionResponse;
      const startCommData: IMcaStartComActionData = response.getResponseData();
      const engagementContext: IEngagementContext = startCommData.getEngagementContext();
      const engagementId: string = engagementContext.getEngagementId();
  }).catch(() => {
  })
  
The following is a code sample in Javascript.
const uiEventsFrameworkInstance = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
  const multiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
  const phoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE');
  const request = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent');
  // You should set correct appClassification here. eg: ORA_SERVICE for Service App
  // Refer https://docs.oracle.com/en/cloud/saas/fusion-service/fairs/application-classification-code.html#s20059918 for the list of supported app classifications
  request.setAppClassification('appClassfication');
  request.setEventId('1'); // Set the event ID here
  const inData = request.getInData();
  phoneContext.publish(request).then((response) => {
      const startCommData = response.getResponseData();
      const engagementContext = startCommData.getEngagementContext();
      const engagementId = engagementContext.getEngagementId();
  })

getTabContext

Use this function to get the tabContext on which the engagement object or new call connection is started. This will be of type ITabContext and you can get the active and available records on this tabContext and perform actions on it.

The following sample shows the syntax:
getTabContext(): Promise<ITabContext>;
The following is a code sample in Typescript.
/// <reference path="uiEventsFramework.d.ts"/>  
          const uiEventsFrameworkInstance: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
          const multiChannelAdaptorContext: IMultiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
          const phoneContext: IPhoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE') as IPhoneContext;
          const request: IMcaStartCommEventActionRequest = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent') as IMcaStartCommEventActionRequest;
          request.setAppClassification('appClassfication');// You should set correct appClassification here. eg: ORA_SERVICE for Service App
          request.setEventId('1'); // Set the event ID here
          const inData: IMcaStartCommInDataRequest = request.getInData();
          phoneContext.publish(request).then(async (res: IOperationResponse) => {
              const response: IMcaStartComActionResponse = res as IMcaStartComActionResponse;
              const startCommData: IMcaStartComActionData = response.getResponseData();
              const engagementContext: IEngagementContext = startCommData.getEngagementContext();
              const tabContext: ITabContext = await engagementContext.getTabContext();
          }).catch(() => {
          })
  
IEngagementContextIFieldValueChangeEventRequest
The following is a code sample in Javascript.
const uiEventsFrameworkInstance = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
  const multiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
  const phoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE');
  const request = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent');
  request.setAppClassification('appClassfication');// You should set correct appClassification here. eg: ORA_SERVICE for Service App
  request.setEventId('1'); // Set the event ID here
  const inData = request.getInData();
  phoneContext.publish(request).then((response) => {
      const startCommData = response.getResponseData();
      const engagementContext = startCommData.getEngagementContext();
      const engagementId = engagementContext.getEngagementId();
      const tabContext = await engagementContext.getTabContext();
  })

getEngagementData

Use this function to fetch the data in the engagement object.

The following sample shows the syntax:
getEngagementData(): IMcaEngagementData;
The following is a code sample in Typescript.
/// <reference path="uiEventsFramework.d.ts"/> 
  const uiEventsFrameworkInstance: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
  const multiChannelAdaptorContext: IMultiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
  const phoneContext: IPhoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE') as IPhoneContext;
  const request: IMcaStartCommEventActionRequest = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent') as IMcaStartCommEventActionRequest;
  // You should set correct appClassification here. eg: ORA_SERVICE for Service App
  // Refer https://docs.oracle.com/en/cloud/saas/fusion-service/fairs/application-classification-code.html#s20059918 for the list of supported app classifications
  request.setAppClassification('appClassfication');
  request.setEventId('1'); // Set the event ID here
  const inData: IMcaStartCommInDataRequest = request.getInData();
  phoneContext.publish(request).then(async (res: IOperationResponse) => {
      const response: IMcaStartComActionResponse = res as IMcaStartComActionResponse;
      const startCommData: IMcaStartComActionData = response.getResponseData();
      const engagementContext: IEngagementContext = startCommData.getEngagementContext();
      const engagementData: IMcaEngagementData = await engagementContext.getEngagementData();
  }).catch(() => {
  })
  
The following is a code sample in Javascript.
const uiEventsFrameworkInstance = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
const multiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
const phoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE');
const request = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent');
 // You should set correct appClassification here. eg: ORA_SERVICE for Service App
// Refer https://docs.oracle.com/en/cloud/saas/fusion-service/fairs/application-classification-code.html#s20059918 for the list of supported app classifications
request.setAppClassification('appClassfication');
request.setEventId('1'); // Set the event ID here
const inData = request.getInData();
phoneContext.publish(request).then((response) => {
    const startCommData = response.getResponseData();
    const engagementContext = startCommData.getEngagementContext();
    const engagementId = engagementContext.getEngagementId();
    const engagementData = await engagementContext.getEngagementData();
})

getChannelType

Use this function to get the channel type in EngagementContext API requests, such as ORA_SVC_PHONE.

The following sample shows the syntax:
getChannelType(): string;
The following is a code sample in Typescript.
/// <reference path="uiEventsFramework.d.ts"/>  
   const uiEventsFrameworkInstance: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
          const multiChannelAdaptorContext: IMultiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
          const phoneContext: IPhoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE') as IPhoneContext;
          const request: IMcaStartCommEventActionRequest = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent') as IMcaStartCommEventActionRequest;
          request.setAppClassification('appClassfication');
          request.setInputData({eventId: 'id'});// _inboundData of type - IMcaStartCommInData
          const inData: IMcaStartCommInDataRequest = request.getInData();
          phoneContext.publish(request).then(async (res: IOperationResponse) => {
              const response: IMcaStartComActionResponse = res as IMcaStartComActionResponse;
              const startCommData: IMcaStartComActionData = response.getResponseData();
              const engagementContext: IEngagementContext = startCommData.getEngagementContext();
              const channelType: string = await engagementContext.getChannelType();
          }).catch(() => {
          })      
The following is a code sample in Javascript.
const uiEventsFrameworkInstance = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
  const multiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
  const phoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE');
  const request = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent');
  request.setAppClassification('appClassfication');
  request.setInputData({eventId: 'id'});// _inboundData of type - IMcaStartCommInData
  const inData = request.getInData();
  phoneContext.publish(request).then((response) => {
      const startCommData = response.getResponseData();
      const engagementContext = startCommData.getEngagementContext();
      const channelType = await engagementContext.getChannelType();
  })

getChannel

Use this function to get the type in EngagementContext object. Value will be PHONE.

The following sample shows the syntax:
getChannel(): string;
The following is a code sample in Typescript.
/// <reference path="uiEventsFramework.d.ts"/>      const uiEventsFrameworkInstance: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
  const multiChannelAdaptorContext: IMultiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
  const phoneContext: IPhoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE') as IPhoneContext;
  const request: IMcaStartCommEventActionRequest = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent') as IMcaStartCommEventActionRequest;
  // You should set correct appClassification here. eg: ORA_SERVICE for Service App
  // Refer to Application Classification Code for the list of supported app classifications  
  request.setAppClassification('appClassfication');
  request.setEventId('1'); // Set the event ID here
  const inData: IMcaStartCommInDataRequest = request.getInData();
  phoneContext.publish(request).then(async (res: IOperationResponse) => {
      const response: IMcaStartComActionResponse = res as IMcaStartComActionResponse;
      const startCommData: IMcaStartComActionData = response.getResponseData();
      const engagementContext: IEngagementContext = startCommData.getEngagementContext();
      const channel: string = await engagementContext.getChannel(); // 'PHONE'
  }).catch(() => {
  })
  
The following is a code sample in Javascript.
const uiEventsFrameworkInstance = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
  const multiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
  const phoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE');
  const request = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent');
  // You should set correct appClassification here. eg: ORA_SERVICE for Service App
  // Refer to Application Classification Code for the list of supported app classifications
  request.setAppClassification('appClassfication');
  request.setEventId('1'); // Set the event ID here
  const inData = request.getInData();
  phoneContext.publish(request).then((response) => {
      const startCommData = response.getResponseData();
      const engagementContext = startCommData.getEngagementContext();
      const engagementId = engagementContext.getEngagementId();
      const channel = await engagementContext.getChannel(); // 'PHONE'
  })

getWrapupContext

To interact with UEF, RecordContext of WrapUp is available from EngagementContext.

We can get wrapupContext from either of two ways:
  • From startComm if transcript is enabled
  • From closeComm , which is available if transcript is enabled or disabled.

Users can perform UEF recordLevel actions like Set Field, Get Field, Save Operation and events like Field Value change, OnBeforeSave, OnAfterSave from the WrapUpRecordContext. See the following examples.

The function to get the Wrapup Record Context on which the engagement object or new call connection is started or ended. This will be of type IRecordContext and so, will get the RecordContext of WrapUp and perform actions and events on it.

The following sample shows the syntax:
getRecordContext(): Promise<IRecordContext>;
The following is a code sample of getWrapupContext API on engagementContext in Typescript.
/// <reference path="uiEventsFramework.d.ts"/> 
          const uiEventsFrameworkInstance: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
          const multiChannelAdaptorContext: IMultiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
          const phoneContext: IPhoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE') as IPhoneContext;
          const request: IMcaStartCommEventActionRequest = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent') as IMcaStartCommEventActionRequest;
          request.setAppClassification('appClassfication');
          request.setInputData({eventId: 'id'});// _inboundData of type - IMcaStartCommInData
          const inData: IMcaStartCommInDataRequest = request.getInData();
          phoneContext.publish(request).then(async (res: IOperationResponse) => {
              const response: IMcaStartComActionResponse = res as IMcaStartComActionResponse;
              const startCommData: IMcaStartComActionData = response.getResponseData();
              const engagementContext: IEngagementContext = startCommData.getEngagementContext();
              const recordContext: IRecordContext = await engagementContext.getWrapupContext();
          }).catch(() => {
          })
  
The following is a code sample of getWrapupContext API on engagementContext in Javascript.
const uiEventsFrameworkInstance = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
  const multiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
  const phoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE');
  const request = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent');
  request.setAppClassification('appClassfication');
  request.setInputData({eventId: 'id'});// _inboundData of type - IMcaStartCommInData
  const inData = request.getInData();
  phoneContext.publish(request).then((response) => {
      const startCommData = response.getResponseData();
      const engagementContext = startCommData.getEngagementContext();
      const engagementId = engagementContext.getEngagementId();
      const recordContext = await engagementContext.getWrapupContext();
  })

publish

Use this function to publish an operation at engagement Context.

The following code sample shows the syntax:
publish: (requestObject: IOperationRequest) => Promise<IOperationResponse>;