• AdaptiDev
  • NEWBIE
  • 25 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 4
    Replies

Hello,

 

I have a problem with the @Future in Apex and a VisualForce page.

 

Problem:
I need a function that can create PDF files out of a VF page and send this byEmail. And I want to processes many records (between 150 and 750 records) byclicking 1 button.

Tried this:
I have a APEX class that is executed @Future.
This Class will select some records (accounts) and then loop these records.
In this loop an existing VF page is "called"/"created" withthe record ID as parameter. This page is a VisualForce page withRenderAs="PDF".

So I just want to get a PDF file based on that VF page and the record ID.

Then I want to send out an email with some of these PDF files as attachments.

When I run this code on a selection with 1 record and I don't use @future,everything works. I recieve an email with a PDF attachment and the rightcontent is in the PDF.

When I run this code on many records and don't use @future, I get a time outerror in the browser.

When I run this code on many records and use @future, It seems to work becauseafter a while I recieve an email with many attachments, but I can not open theatatchments because they are no good PDF files and all of the same size : 2 kb. The normal PDF should be like 14 KB.

How can I fix this?

 

Kind regards,

 

Bart Caelen

Adapti 

Message Edited by AdaptiDev on 01-22-2010 05:33 AM
Message Edited by AdaptiDev on 01-22-2010 06:13 AM

Hello,

 

Whole day I've tried to Connect from a Flex app to a salesforce webservice. I started with a simple HelloWorld with parameters of default types (String, Integer, ...)

 

Now I want to send a model (MyContact) to the apex webservice and then return MyContact.firstName and MyContact.lastName.

 

Here my apex webservice:

 

global class HelloWorldWebservice{
   

    //MyContact model
    global class MyContact
    {
        webservice String lastName;
        webservice String firstName;
    }
   

    WebService static String SayHelloName(String name){
        return 'Hello '+name+ '!';
    }
   
    WebService static String SayHelloContact(MyContact mycontact){
        return 'Hello '+contact.firstName+ ' ' +contact.lastName+'!';
    }
}

 

To call the SayHelloName method in Flex I used the following:

 

var object:Parameter = new Parameter("name", helloInput.text); var params:Array = [object];

 

force.execute("HelloWorldWebservice","SayHelloName",params,new AsyncResponder(SayHelloNameSuccess, faultResponder));

 

Above works perfect, but my next challenge is to send a model MyContact to the webservice, this is what I have at the moment:

 

var firstName:Parameter = new Parameter("firstName","Kevin"); var lastName:Parameter = new Parameter("lastName","Neuteleers");

 

var myContactFields:Array = [firstName, lastName];

 

var myContact:Parameter = new Parameter("mycontact", myContactFields);

var params:Array = [myContact];

 

force.execute("HelloWorldWebservice","SayHelloContact",params,new AsyncResponder(SayHelloNameSuccess, faultResponder));

 

Hopefully there's someone who knows an answer and wants to help me.

 

I have a webservice which will recieve some account data with orders and orderlines.  This data is coming from a webshop.

 

They have to process up to 2000 orders (calls to this webservice) each day.

 

Is there a limit on how many external calls you can  do to a sfdc webservice?

I think there must be a limit, but I 'm not finding it.

 

Thank you for the info.

I have created a custom component with a controller.

 

When you put this custom controller on a page, you have to set 2 parameters (objectname & searchtext).

The controller will get the values out of this custom controller by doing:

 

String strObjectName = System.currentPageReference().getParameters().get('objectname');

String strText = '%'+System.currentPageReference().getParameters().get('searchtext')+'%';

 
 
Everything is working but now I need to create a test class to deploy this component and controller.
 
How can I create a Test class that will pass the 2 parameters to the controller or how can I make the controller get a result out of System.currentPageReference().getParameters().get('objectname'); ?
 
Thanks for the info? 

I want to limit the results of a SOQL statements so that this SOQL only returns the records the user is allowed to see.

 

eg.

 

[SELECT FirstName, LastName FROM Contact]  should result in a List of Contacts that the active user has access to.

 

I know you can do a RunAs(user) but this can only be used in a Test class.

 

 

I 'm looking for this a long time, but I don't find solutions for this problem.

 

Thank you.

Hello,

 

Whole day I've tried to Connect from a Flex app to a salesforce webservice. I started with a simple HelloWorld with parameters of default types (String, Integer, ...)

 

Now I want to send a model (MyContact) to the apex webservice and then return MyContact.firstName and MyContact.lastName.

 

Here my apex webservice:

 

global class HelloWorldWebservice{
   

    //MyContact model
    global class MyContact
    {
        webservice String lastName;
        webservice String firstName;
    }
   

    WebService static String SayHelloName(String name){
        return 'Hello '+name+ '!';
    }
   
    WebService static String SayHelloContact(MyContact mycontact){
        return 'Hello '+contact.firstName+ ' ' +contact.lastName+'!';
    }
}

 

To call the SayHelloName method in Flex I used the following:

 

var object:Parameter = new Parameter("name", helloInput.text); var params:Array = [object];

 

force.execute("HelloWorldWebservice","SayHelloName",params,new AsyncResponder(SayHelloNameSuccess, faultResponder));

 

Above works perfect, but my next challenge is to send a model MyContact to the webservice, this is what I have at the moment:

 

var firstName:Parameter = new Parameter("firstName","Kevin"); var lastName:Parameter = new Parameter("lastName","Neuteleers");

 

var myContactFields:Array = [firstName, lastName];

 

var myContact:Parameter = new Parameter("mycontact", myContactFields);

var params:Array = [myContact];

 

force.execute("HelloWorldWebservice","SayHelloContact",params,new AsyncResponder(SayHelloNameSuccess, faultResponder));

 

Hopefully there's someone who knows an answer and wants to help me.

 

I have created a custom component with a controller.

 

When you put this custom controller on a page, you have to set 2 parameters (objectname & searchtext).

The controller will get the values out of this custom controller by doing:

 

String strObjectName = System.currentPageReference().getParameters().get('objectname');

String strText = '%'+System.currentPageReference().getParameters().get('searchtext')+'%';

 
 
Everything is working but now I need to create a test class to deploy this component and controller.
 
How can I create a Test class that will pass the 2 parameters to the controller or how can I make the controller get a result out of System.currentPageReference().getParameters().get('objectname'); ?
 
Thanks for the info? 

I want to limit the results of a SOQL statements so that this SOQL only returns the records the user is allowed to see.

 

eg.

 

[SELECT FirstName, LastName FROM Contact]  should result in a List of Contacts that the active user has access to.

 

I know you can do a RunAs(user) but this can only be used in a Test class.

 

 

I 'm looking for this a long time, but I don't find solutions for this problem.

 

Thank you.

The links below show what the page should look like and what it actually looks like now.

 

Correct Version

 

Incorrect Version

 

My initial thought was to use the CSS position property and just put the bottom of the table row where I need it to be. However, no matter what I put for the position, the actual height of the table row never changed.

 

I came up with a kludgey solution that sets the height of the last table row (all blank spaces) based on the number of items in the memo through my VF page controller.

I.E. If their are 3 items the table row height is 250px and with 2 items it is 300px.

 

However, this solution has some issues and it seems like there should be a much better way to do it.

 

 

So,  am I missing some obvious bit of CSS that does what I need to do? Should I be doing this through VF somehow?

 

--Greg