Learn about Redwood and be one of the first to join the conversation

Visit Redwood Community
removed — Cloud Customer Connect
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

removed

Received Response
13
Views
3
Comments
golan dor
golan dor Member
edited Jun 13, 2022 4:12AM in General Technical Discussions 3 comments

Answers

  • Sono Chacko-Oracle
    Sono Chacko-Oracle Silver Medal
    edited Jun 4, 2020 9:35AM

     Just return a promise and once your async operation completed(Request finished), resolve that promise with value from the async operation.

  • Sono Chacko-Oracle
    Sono Chacko-Oracle Silver Medal
    edited Jun 4, 2020 9:48AM

    Sample Typescript code:

    ORACLE_SERVICE_CLOUD.extension_loader.load('LOAD DATA ASYNC').then((extensionProvider: IExtensionProvider)=>{
        extensionProvider.registerAnalyticsExtension((analyticsContext: IAnalyticsContext)=>{
            analyticsContext.addTableDataRequestListener('Package$Table', tableListener);
        });
    
        function tableListener(report: IExtensionReport): IExtensionPromise<IReportData> {
            const extensionPromise: IExtensionPromise<IReportData> = new ExtensionPromise();
            const reportData: IReportData = report.createReportData();
            $.ajax('sampleurl').done((data) => {
                //Todo populate reportData from response
                extensionPromise.resolve(reportData);
            });
            return extensionPromise;
        }
    });
  • Sono Chacko-Oracle
    Sono Chacko-Oracle Silver Medal
    edited Jun 4, 2020 9:49AM

    Sample Javascript:

    ORACLE_SERVICE_CLOUD.extension_loader.load('LOAD DATA ASYNC').then(function (extensionProvider) {
        extensionProvider.registerAnalyticsExtension(function (analyticsContext) {
            analyticsContext.addTableDataRequestListener('Package$Table', tableListener);
        });
        function tableListener(report) {
            var extensionPromise = new ExtensionPromise();
            var reportData = report.createReportData();
            $.ajax('sampleurl').done(function (data) {
                //Todo populate reportData from response
                extensionPromise.resolve(reportData);
            });
            return extensionPromise;
        }
    });