Exporting dashboard using share and scripting method

Hi all,
I am having a problem exporting using both the share and scripting method. for the scripting method here is the script being used

// ************************************************************************************
//
// This implementation uses dundas.export.ExportHelper class and is only available in
// v8 or higher.
//
// ************************************************************************************

// Create the Excel Options
// https://www.dundas.com/support/api-docs/js/#API%20Reference/dundas/export/ExportHelper/Methods/exportExcel.html
var excelOptions =
{
appendDateToFileName: false,
overrideFileName: false,
openOnCompletion: true,
enableOverlay: false,
selection: dundas.export.ExportSelection.ALL_VISIBLE,
// excludeStyles: isLegacyExportCheckbox.control.value
};

// Export the Excel with the Excel options.
// https://www.dundas.com/support/api-docs/js/#API%20Reference/dundas/export/ExportHelper/Methods/exportExcel.html
dundas.export.ExportHelper.exportExcel(excelOptions);

// ************************************************************************************
//
// This implementation was written before the dundas.export.ExportHelper class was
// created. If you are v8 and above you should use this class when exporting as it
// is designed to be simple. If you are v7 and below you can still use this
// implementation below.
//
// ************************************************************************************

// Get the export service.
var exportService = this.getService(‘ExportService’);

// Get the view service.
var viewService = this.getService(‘ViewService’);

// Create the export request.
var exportRequest =
new dundas.export.ExportRequest(
{
isLegacyExport: isLegacyExportCheckbox.control.value,
// Export Excel
providerId: dundas.constants.STANDARD_EXCEL_EXPORT_PROVIDER_ID,
viewId: this.parentView.id,
viewData: this.getService(“CanvasService”).canvas.viewModel.businessObject.control
});

// Get the perform export promise.
var exportPromise =
exportService.performExport(exportRequest);

// Setup a loading dialog.
viewService.showLoadingRestCall(exportPromise);

exportPromise.done(
function(exportId)
{
// Get the Url for the export file.
var exportFileUrl =
exportService.getExportResultUrl(exportId);

  	// Force the browser to download the file.  
  	window.location.replace(exportFileUrl);
}

);

and here is the error given when using both script and share button:
The Scheduler service encountered an error connecting to the Dundas BI server at https://localhost:4000/. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. Ensure the value for the ‘Internal Application URL’ configuration setting is correct.

This likely means that the Internal Application URL setting on your server is incorrect - this setting is found via Admin > Setup > Config.

https://www.dundas.com/support/learning/documentation/administration-configuration-customization/how-to/configuring-notifications-and-other-scheduling-features#h3-1-internal-application-url

While your application and external app URL can and should be hosted via HTTPS, your internal app URL should be the IP/port binding corresponding to an HTTP binding - SSL can make exports slower and cause complications otherwise, so at least as far as the internal app URL is concerned, it is better to use an HTTP binding.