• Admin Xti
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
500 status code return from request to 
In Production have some reports what I want is a report to run every month and save it inside a custom folder.
In Open Execute Anonymous Window, I run the following code:
 
    ApexPages.PageReference report = null;
    report = new ApexPages.PageReference('/idProductionReport?excel=printable+view');
    Document document = new Document();
    document.Name = 'ReportTest.xls';
    document.AuthorId = UserInfo.getUserId();
    document.FolderId = idFolderProduction;
    document.body = report.getContent();
    document.ContentType = 'application/vnd.ms-excel';
    insert document;
        
In the line 7 is where it shows EXCEPTION_THROWN [7]|System.VisualforceException: 500 status code return from request to https://naXX.salesforce.com/idProductionReport?excel=printable+view&inline=1

The same code work in Sandbox, but not in production

Thanks