I need to generate automatically multiple PDF files and save them as attachments in its correspondent objects records. I have tried to resolve this topic making use of a batch file and a rendered visualForce page as 'PDF' but Salesforce have here a limit not allowing to use a getContent() method in a batch class.
Searching in the internet I have found this possible solution:
Why are HTML emails being sent by a APEX Schedulable class being delivered with blank bodies?
It propose to:
- Create a class which implements the Schedulable interface.
- Have an execute() method call and a @future method.
- Create a @future method that call a web service enabled method in the class that sends the email.
The problem I found is when I try to authenticate in my Web Services (REST) inside Salesforce (http://help.salesforce.com/help/doc/en/remoteaccess_oauth_web_server_flow.htm)
In the first step I am making a request and I get a code through the callback URL, but It is impossible to know how to read this parameter from Salesforce. In the answer I don't have a method called 'getParameter()' and the body is empty.
As an example:
Request: https://login.salesforce.com/services/oauth2/authorize?response_type=code&client_id= 3MVG9lKcPoNINVBIPJjdw1J9LLM82HnFVVX19KY1uA5mu0QqEWhqKpoW3svG3XHrXDiCQjK1mdgAvhCscA 9GE&redirect_uri=https%3A%2F%2Fwww.mysite.com%2Fcode_callback.jsp&state=mystate
Response: https://www.mysite.com/code_callback.jsp?code=aPrxsmIEeqM9&state=mystate
It exists any way to connect with my Webservices making the call inside Salesforce in order to implement this solution??
It would be easier if a make a call from an external application but inside salesforce???
Can you suggest any possible solution???