Message Composer Event Listeners
The 25A Fusion Service Center introduces new extensibility features through Message Composer Event Listeners. These features enhance the functionality and customization options for Service Request objects. The key components are:
- OnBeforeMessageSend Event: Allows custom actions and approval processes before a message is sent. It supports asynchronous operations and can control the message sending flow.
- OnAfterMessageSent Event: Triggers after a message is successfully sent, enabling post-send actions or notifications.
- SetComposeMessageData: Enables programmatic setting of message composition data, including recipient addresses, subject, body, and custom fields.
These features support various message types (Internal Note, Email, Web Message, Customer Entry) and integrate with the existing RecordContext system. They provide developers and administrators with powerful tools to customize and extend the messaging capabilities within the Fusion Service Center environment.
Implementation is facilitated through the UI Events Framework, with code examples provided for each feature. This enhancement aims to improve workflow efficiency and allow for more tailored communication processes within the application.
Steps to Enable
The following steps assume familiarity with the UI Events Framework. For more detailed information, please refer to our product documentation.
OnBeforeMessageSend Event
In Fusion applications, when an agent opens an object like a Service Request (SR), they can start composing a message using a smart action. This opens a message panel where the agent can write and send messages.
The OnBeforeMessageSend event happens just before a message is sent for a specific record. It allows for the following:
- Performing additional actions before the message is sent
- Approving or canceling the message send process
- Waiting for these actions to finish before proceeding
To use this event, you need to specify which type of message you're interested in.
Currently, this event works only for Service Request objects in the 25A release.
Message Types You Can Use
Here are the different types of messages you can work with:
- Internal note (ORA_SVC_INTERNAL_NOTE)
- Email (ORA_SVC_EMAIL)
- Web Message (ORA_SVC_WEB)
- Customer Message (ORA_SVC_CUSTOMER_ENTRY)
- Any type of message (ANY)
Note: You can listen for the OnBeforeMessageSend event using RecordContext
Here's an example of how to use the OnBeforeMessageSend event for Web Messages:
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID');
const tabContext = await frameworkProvider.getTabContext();
const recordContext = await tabContext.getActiveRecord();
requestObject.setMessageType('ORA_SVC_WEB');
const requestObject = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusOnBeforeMessageSendEvent');
recordContext.subscribe(requestObject, (response) => {
const messageType = response.getResponseData().getMessageType();
return new Promise((resolve, reject) => {
// custom logic to resolve or reject the message send flow.
});
});
OnAfterMessageSent Event
In Fusion applications, when an agent opens an object like a Service Request (SR), they can send messages using a message panel. The OnAfterMessageSent event happens right after a message is successfully sent.
To use this event, you need to specify which type of message you're interested in. Currently, this event works only for Service Request objects in the 25A release.
Here are the different types of messages you can work with:
- Internal note (ORA_SVC_INTERNAL_NOTE)
- Email (ORA_SVC_EMAIL)
- Web Message (ORA_SVC_WEB)
- Customer Message (ORA_SVC_CUSTOMER_ENTRY)
- Any type of message (ANY)
Note: You can listen for the OnAfterMessageSent event using RecordContext
Here's an example of how to use the OnAfterMessageSent event for Web Messages:
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID');
const tabContext = await frameworkProvider.getTabContext();
const recordContext = await tabContext.getActiveRecord();
const requestObject = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusOnAfterMessageSentEvent');
recordContext.subscribe(requestObject, (response) => {
const messageType = response.getResponseData().getMessageType();
});
SetComposeMessageData
In Fusion applications, when an agent opens an object like a Service Request (SR), they can start composing a message using a smart action. This opens a message panel where the agent can write and send messages.
SetComposeMessageData is a feature that allows automatic setting of information in the message panel. It can fill in fields like CC, BCC, To Address, Subject, and Body. It can also set values for custom fields added to the message layout. In the 25A release, this feature works only for Service Request objects.
Message Types You Can Use
Here are the different types of messages you can work with:
- Internal note (ORA_SVC_INTERNAL_NOTE)
- Email (ORA_SVC_EMAIL)
- Web Message (ORA_SVC_WEB)
- Customer Message (ORA_SVC_CUSTOMER_ENTRY)
- Any type of message (ANY) - This includes all of the above types
Note: You can use SetComposeMessageData with RecordContext
The next section shows how SetComposeMessageData is structured in the code.
interface IComposeMessageDataRequest {
setToAddress(partyName: string, partyId: string, emailAddress: string, viaId?: string): void;
setCCAddress(partyName: string, partyId: string, emailAddress: string, viaId?: string): void;
setBCCAddress(partyName: string, partyId: string, emailAddress: string, viaId?: string): void;
setSubject(subject: string): void; setMessageBody(messageContent: string): void;
setFieldValue(fieldName: string, fieldValue: string): void;
}
Please find the code in javaScript to perform SetComposeMessageData operation on Compose Email
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID');
const tabContext = await frameworkProvider.getTabContext();
const recordContext = await tabContext.getActiveRecord();
const srequestObject = frameworkProvider.requestHelper.createPublishRequest('cxEventBusSetComposeMessageDataOperation');
srequestObject.setMessageType('ORA_SVC_EMAIL');
const messageData = srequestObject.setMessageData();
messageData.setCCAddress('Matt Liu', '300100032899579', 'sendmail-test-discard@oracle.com', '');
messageData.setSubject('UEF Test');
messageData.setMessageBody('Message Body UEF Test');
messageData.setToAddress('Matt Liu', '300100032899579', 'sendmail-test-discard@oracle.com', '');
messageData.setFieldValue('CustomField', 'CustomValue');
const response = await recordContext.publish(srequestObject);
console.log('setMessageDataResponse', response)
Tips And Considerations
n/a
Key Resources
n/a
Access Requirements
n/a