• wongt
  • NEWBIE
  • 50 Points
  • Member since 2009

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 7
    Replies

Hi all,

 

Im newbie in force.com, and i have a question, my question is that: i want to export list of object into CSV file using Apex. So please help me how to do this?

 

Thanks,

I apologize for this totally newbie question, but I've exhausted all manuals and google, tried all possible combinations, but I'm stuck. I feel like an idiot for even having to ask, but any help is greatly appreciated.

 

Here's the code --

 

 

//PART 1: The search -
force.search("FIND {test} IN ALL FIELDS RETURNING Contact(id, firstname)", new AsyncResponder(searchHandler));

// ... some code here

//PART 2: searchHandler -
var srArray:ArrayCollection = new ArrayCollection();
srArray = result.searchRecords;
var count:int = 1;
for(var i:int=0; i<srArray.length; i++) {
//None of these worked

//var a:SObject = srArray[i].getFields()[0].record;
//var a:SObject = srArray[i].getFields()[0].Contact;
//var a:SObject = srArray[i].getFields()[0].Name;
dpArray.addItem(
{
No:count,
Name:srArray[i].getFields()[0].toString() //This returns a display of a list of 'record'
}
);
count++;
}

//This returns a display of a list of '[object Object]'
//grid.dataProvider = result.searchRecords;

 

Here's an example of what I'm getting from the code attempts above --

 

 

 

The question is -- how do I get the labels and values out of the collection?

 

Thanks in advance ..

Message Edited by wongt on 10-01-2009 10:09 PM
  • October 02, 2009
  • Like
  • 0

I'm trying to re-create the "Attach File" page using visualforce, but with big files, it is throwing the following error:

 

Maximum view state size limit (128K) exceeded. Actual viewstate size for this page was 142.438K

 

I've already been through the forums and the following post --

http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=10488#M10488

 

I tried commenting out lines to see if it would help, but the error doesn't go away.

 

 Here's the code --

 

 

public class OpportunityAttachFile {
public Opportunity oppty {get;set;}
public String fileName {get;set;}
public List<String> uploadedList {get;set;}
public Blob fileBody {get;set;}

public OpportunityAttachFile (ApexPages.StandardController controller) {
oppty = (Opportunity)controller.getRecord();
uploadedList = new List<String>();
}

public void attachFileAction() {
Attachment a = new Attachment();
a.ParentId = oppty.Id;
a.Name = fileName;
//NOTE: Here, I am commenting out segments of the code just to see if the error would go away, but it does not help.
//a.Body = fileBody;
//insert a;

//Clearing out the contents to avoid hitting viewstate limits
a = null;
}

public PageReference doneAction() {
return new PageReference('/' + oppty.Id);
}
}

 

 Help?
  • July 17, 2009
  • Like
  • 0

I have a requirement to prevent users from deleting Activity Histories for one standard object only.

 

I've looked and there isn't an option to hide visibility of the "delete" link or set permissions to prevent users from deleting the Activity History.

 

I've also explored the possibility of writing a trigger, but it seems like there isn't an option of creating a trigger on the ActivityHistory object.

 

Any ideas or suggestions?

  • July 17, 2009
  • Like
  • 0

I am having some trouble performing searches on time-based workflow.  For debugging purposes, it's very helpful to search for workflows related to a particular record - usually a Contact.  Since we cannot do this with a SOQL query, I'm falling back on the Time-Based Workflow Monitoring page, and am encountering some difficulty with the Record Name field.  Specifically I find that if I supply the Record Name as listed in the search results with the "equals" relation, the search cannot find my workflows.

 

For example, if I create a Contact record with first name Robert, last name Dobbs, and then trigger a workflow on this Contact, an unqualified search on the monitoring page will turn up a workflow queued with the record name "Robert Dobbs".  However, if I do a search for "Record Name" equals "Robert Dobbs", no results will be found.  I've tried numerous variants on the name, and I find that the "equals" check never seems to work.  "starts with" will work, but only (and interestingly!) if I specify the last name - and only the last name.

 

 

Should I be able to search for "Record Name" "equals" Firstname Lastname?

 

Thanks and Regards,

Jeff Trull

 

I am trying to add a block of text (not a field value) to a Quote Template regarding payment terms.

 

For example:

 

"Payment Terms:

 

Cheque, BACS, Credit Card.

 

Payable to Joe Bloggs Company etc"

 

Is this possible?

 

 

Hi all,

 

Im newbie in force.com, and i have a question, my question is that: i want to export list of object into CSV file using Apex. So please help me how to do this?

 

Thanks,

I apologize for this totally newbie question, but I've exhausted all manuals and google, tried all possible combinations, but I'm stuck. I feel like an idiot for even having to ask, but any help is greatly appreciated.

 

Here's the code --

 

 

//PART 1: The search -
force.search("FIND {test} IN ALL FIELDS RETURNING Contact(id, firstname)", new AsyncResponder(searchHandler));

// ... some code here

//PART 2: searchHandler -
var srArray:ArrayCollection = new ArrayCollection();
srArray = result.searchRecords;
var count:int = 1;
for(var i:int=0; i<srArray.length; i++) {
//None of these worked

//var a:SObject = srArray[i].getFields()[0].record;
//var a:SObject = srArray[i].getFields()[0].Contact;
//var a:SObject = srArray[i].getFields()[0].Name;
dpArray.addItem(
{
No:count,
Name:srArray[i].getFields()[0].toString() //This returns a display of a list of 'record'
}
);
count++;
}

//This returns a display of a list of '[object Object]'
//grid.dataProvider = result.searchRecords;

 

Here's an example of what I'm getting from the code attempts above --

 

 

 

The question is -- how do I get the labels and values out of the collection?

 

Thanks in advance ..

Message Edited by wongt on 10-01-2009 10:09 PM
  • October 02, 2009
  • Like
  • 0

I have a requirement to prevent users from deleting Activity Histories for one standard object only.

 

I've looked and there isn't an option to hide visibility of the "delete" link or set permissions to prevent users from deleting the Activity History.

 

I've also explored the possibility of writing a trigger, but it seems like there isn't an option of creating a trigger on the ActivityHistory object.

 

Any ideas or suggestions?

  • July 17, 2009
  • Like
  • 0

Is there anyway to configure the contracts page so when an opportunity is converted, it automatically fills in the "account name" from the opportunity page?

 

Thanks so much!