On After Save Event

This event is started after successfully saving a record in the VB application. This is a record level event, so the user must call the subscribe API on top of record context to subscribe to it.

This event response gives information about the saved object's type and its old and new identifiers. The old identifier and new identifier is different only when a save event happens on a new object. For example, while creating a new object UEF assigns a -ve identifier to it, and this -ve identifier is received in the ContextOpen event's subscription response. After saving, this object is assigned an actual identifier, and the new or actual identifier value can be tracked by adding the OnAfterSave Event listener to this new object.
Note: OnAfterSave is an event listenable from RecordContext.
The following code sample shows an example in TypeScript for subscribing to OnAfterSave event:
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID','V1');
    const tabContext = await frameworkProvider.getTabContext();
    const recordContext = await tabContext.getActiveRecord();
    const requestObject: IEventRequest = 
frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusOnAfterSaveEvent');
    recordContext.subscribe(requestObject, (message: IEventResponse) => {
        const response: IOnAfterSaveEventResponse = message as IOnAfterSaveEventResponse;
        const oldObjectId: string = response.getResponseData().getOldObjectId();
        const newObjectId: string = response.getResponseData().getObjectId();
        const objectType: string = response.getResponseData().getObjectType();
    });
The following code sample shows an example in JavaScript for subscribing to OnAfterSave event:
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.createSubscriptionRequest('cxEventBusOnAfterSaveEvent');
    recordContext.subscribe(requestObject, (response) => {
        const oldObjectId = response.getResponseData().getOldObjectId();
        const newObjectId = response.getResponseData().getObjectId();
        const objectType = response.getResponseData().getObjectType();
    });