Timeline for Best way to create PDFs on a schedule?
Current License: CC BY-SA 3.0
20 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 14, 2014 at 11:43 | comment | added | Phil Hawthorn | The last snippet in Dev console, i.e. execute immediate | |
Aug 14, 2014 at 10:17 | comment | added | Testing_SFDC | Hi Phill, where are you putting the last piece of code you provided? | |
Jul 18, 2013 at 11:14 | comment | added | Phil Hawthorn | Ok, on your response object, retrieve the body (getBody()) and see if that gives you an extra clue, you should receive some JSON in there with some additional info. I just tried your request from Advance Rest Client and got 'session expired or invalid ' (side note, you probably shouldn't paste Session IDs in here) | |
Jul 18, 2013 at 9:49 | comment | added | Davin Casey | 10:45:21.165 (165014000)|USER_DEBUG|[37]|DEBUG|Davin - Calling: System.Http[] with System.HttpRequest[Endpoint=cs7.salesforce.com/services/apexrest/AttachPDF/…, Method=GET] 10:45:21.165 (165111000)|CALLOUT_REQUEST|[38]|System.HttpRequest[Endpoint=cs7.salesforce.com/services/apexrest/AttachPDF/…, Method=GET] 10:45:21.278 (278421000)|CALLOUT_RESPONSE|[38]|System.HttpResponse[Status=Unauthorized, StatusCode=401] 10:45:21.278 (278572000)|USER_DEBUG|[39]|DEBUG|Davin - Response: System.HttpResponse[Status=Unauthorized, StatusCode=401] | |
Jul 18, 2013 at 9:48 | comment | added | Davin Casey | Same result I'm afraid, here's a debug print showing what's going on: 10:45:21.164 (164657000)|METHOD_ENTRY|[1]|01pM00000001Y1D|AttachPDFService.AttachPDFToRecord(Id, String) 10:45:21.164 (164770000)|USER_DEBUG|[28]|DEBUG|Davin - recordId: a0kb0000000UE2qAAG 10:45:21.164 (164794000)|USER_DEBUG|[29]|DEBUG|Davin - sessionId: 00DM0000000CmFZ!ARAAQC7MZ7h.yyjJPdVzhtSzVzEnA8OAuYW9cYwv.GcOYFmJlrpnJkSXZ6mMHcIF0r3ZQP8jJlU8dArOHHVFtqjMsMfFE9P7 | |
Jul 18, 2013 at 8:48 | history | edited | Phil Hawthorn | CC BY-SA 3.0 |
deleted 45 characters in body
|
Jul 18, 2013 at 8:46 | comment | added | Phil Hawthorn | The only way I can get that is to pass in a garbage Session ID. Are you sure your Session ID is valid? Are you able to call it successfully in an interactive context, e.g. AttachPDFService.attachPDFToRecord('a0kb0000000UE2q',UserInfo.getSessionId()); | |
Jul 18, 2013 at 8:27 | comment | added | Davin Casey | I spotted that, same response with the / though. Proper head scratcher... | |
Jul 17, 2013 at 16:43 | comment | added | Phil Hawthorn | May or may not be the issue, but you need an additional / where you have /apexrest/AttachPDFa0DM0000007Ll6pMAC it should be /apexrest/AttachPDF/a0DM0000007Ll6pMAC | |
Jul 17, 2013 at 15:17 | comment | added | Davin Casey | I'm getting a 401 response: 'DEBUG|Davin - Response: System.HttpResponse[Status=Unauthorized, StatusCode=401]'. This is my call: 'DEBUG|Davin - Calling: System.Http[] with System.HttpRequest[Endpoint=cs7.salesforce.com/services/apexrest/…, Method=GET]'. | |
Jul 16, 2013 at 15:42 | history | edited | Phil Hawthorn | CC BY-SA 3.0 |
added 2292 characters in body
|
Jul 16, 2013 at 15:37 | comment | added | Phil Hawthorn | Ok, belt and braces i'm putting my scheduled batch class on too | |
Jul 16, 2013 at 15:00 | comment | added | Davin Casey | The class already implemented those, strange... 'global class BatchCreatePDFs implements Database.Batchable<sObject>, Database.Stateful, Database.AllowsCallouts' | |
Jul 16, 2013 at 11:28 | comment | added | Phil Hawthorn | Yes, you have to have implements Database.Batchable, Database.AllowCallouts, Database.Stateful on your Batch Apex class declaration, have a butchers at salesforce.com/us/developer/docs/apexcode/Content/… | |
Jul 16, 2013 at 11:05 | comment | added | Davin Casey | I tried it, but I'm getting this error: 'Callout from scheduled Apex not supported.' My code structure is I have a schedulable class, which calls a batch class which calls 'attachPdfToRecord' as you recommended. Any ideas on a resolution? | |
Jul 16, 2013 at 6:53 | comment | added | Davin Casey | Cheers mate I'll give it a try. | |
Jul 16, 2013 at 6:50 | comment | added | Phil Hawthorn | Basic sample added above, you'd be advised to add some error checking etc. | |
Jul 16, 2013 at 6:50 | history | edited | Phil Hawthorn | CC BY-SA 3.0 |
added 1531 characters in body
|
Jul 15, 2013 at 23:21 | comment | added | Davin Casey | Sounds good, any chance you have some code samples / examples? It's not a method I'm familiar with, thanks! | |
Jul 15, 2013 at 16:23 | history | answered | Phil Hawthorn | CC BY-SA 3.0 |