Report section not working after extending sugar endpoint ReportsExportApi

Report section not working after extending sugar endpoint ReportsExportApi. Mike Russell

Getting error => Export Type Does Not Exists

My code is,

require_once('modules/Reports/Exporters/ReportExporter.php');
require_once('modules/Reports/templates/templates_export.php');
use Sugarcrm\Sugarcrm\modules\Reports\Exporters\ReportExporter;

class CustomReportsExportApi extends ReportsExportApi {
    // how long the cache is ok, in minutes
    private $cacheLength = 10;

    public function registerApiRest() {
         return parent::registerApiRest(); 
    }

   protected function exportJson(ServiceBase $api, SugarBean $report)
    {
      //currently no code here
   }

} //class close
  • From ReportsExportApi:

            $method = 'export' . ucwords($args['export_type']);

            if(!method_exists($this, $method)) {
                throw new SugarApiExceptionNoMethod('Export Type Does Not Exists');
            }

    It was easy to find, with the exception error message you are getting.

    What does your api payload look like?

    Are you passing on the argument 'export_type' the value 'json', on /Reports/<record>/<export_type> ?

    That should do it

    --

    Enrico Simonetti

    Sugar veteran (from 2007)

    www.naonis.tech


    Feel free to reach out for consulting regarding:

    • API Integration and Automation Services
    • Sugar Architecture
    • Sugar Performance Optimisation
    • Sugar Consulting, Best Practices and Technical Training
    • AWS and Sugar Technical Help
    • CTO-as-a-service
    • Solutions-as-a-service
    • and more!

    All active SugarCRM certifications

    Actively working remotely with customers based in APAC and in the United States

  • No, there is no error in when fetching the reports data. Error occured in Reports module listview section. after adding this custom endpoint. But end point is running and getting result as expected. Please see the screenshot attached.Enrico Simonetti