機械翻訳について

OnBeforeSaveイベント

このイベントは、サーバーにデータをコミットするAPIリクエストの前に開始されます。 次に、このコールバックで非同期操作を実行するか、このイベントを取り消すことができます。 このイベントは、非同期操作が完了するまで待機できます。 このイベントでは、VBでこの操作を承認または取り消すことによって、VBで発生する保存イベントを完全に制御できます。

ノート: OnBeforeSaveは、RecordContextからリスニング可能なイベントです
次のコード・サンプルは、OnBeforeSaveイベントをサブスクライブするためのTypeScriptの例を示しています:
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID','V1');
    const tabContext: ITabContext = await frameworkProvider.getTabContext();
    const recordContext: IRecordContext = await tabContext.getActiveRecord();
     
    const requestObject: IEventRequest = 
frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusOnBeforeSaveEvent');
     
    recordContext.subscribe(requestObject, (response: IEventResponse) => {
        // custom code
        return new Promise((resolve, reject) => {
        });
        // the VB application save can be controlled by either resolving or rejecting this promise.
        // Resolving it would allow the save process, and rejecting the promise will cancel 
the save process inside VB.
        // The save process in VB will wait until this promise is resolved or rejected.
    });
次のコード・サンプルは、OnBeforeSaveイベントをサブスクライブするためのJavaScriptの例を示しています:
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('cxEventBusOnBeforeSaveEvent');
    recordContext.subscribe(requestObject, (response) => {
        // custom code
        return new Promise((resolve, reject) => {
        });
        // the VB application save can be controlled by either resolving or rejecting this promise.
        // Resolving it would allow the save process and rejecting the promise will cancel the save process inside VB.
        // The save process will wait until this promise is resolved or rejected.
    });