• dptr1988
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 9
    Replies
 I want to give the user a list of fields from the 'Contacts' object and have them select the fields that they want to use. Then I want to store that list of fields and retrieve it latter to know which fields to access.
 
 The goal of this program is to allow users to export a contact with one button click. So rather then having them select the fields that they want to export each time, I am wanting to store a pre-selected list of fields and then just exports those fields of the contact that they selected. If they have any custom fields in the 'Contacts' object, I would like to be able to handle those fields too.

In PHP/MySQL, you could just DESCRIBE the table, have the user select the list of field names and then when you go to run the export query, you would just insert the selected field names in the SELECT statement like "SELECT {$field_list} FROM table WHERE id = {$id}".

 After reading the apex manual, the only way that I could find to do this was through 'Dynamic DML' or 'Dynamic SOQL', which according to the manual, is a 'pilot program' and should not be used for regular production. Apparently, apex has just implemented and is testing a 'new' feature that has been around in other programming languages for years? Is there any other way to do this?
 
 Also, does apex have any data type of 'pointers' or 'references' to other variables? I was not able to find a way of making var_1 refer to var_2 so that modifying var_1 would result in var_2 be modified also. The best I could find for pointers was the 'List or Set Iteration For Loops' ( like "for (Integer i : myInts) { /* do something */ }" ). But it almost sounds like they are just assigning the variable 'i' a value from the 'myInts' list rather then making it refer to it. So, it looks like its a 'read-only' reference. Is there any way of doing this?

Peter
 
I'm wanting to create an apex page that will allow users to export contacts into another program, called BBP.

The problem is that each users has their own username and access key that the apex page needs to use to allow them to add a contact to BBP. I don't want the users to have to enter their username and access key each time they export a contact. So I'm wondering how I can store the username and accesskey for each user somewhere in the salesforce account.

I have read through the entire 'salesforce_apex_language_reference.pdf' and 'salesforce_pages_developers_guide.pdf' books but was not able to find anything that would allow me to store settings like that. The best I could find was in the 'ExampleController' code snippet that was demonstrating the difference between transient and non-transient variables. But non-transient variables appear to be erased when the sessions is closed ( ie user logged out or closed browser window ).




Before I use the results in a SOQL single query. How do I check for if the query returned 0 rows? (The size() method is not available in queries where I only expect to get at most one record.

Eg.

Account citizen = [select Id, Name from Account where Name = 'Citizen' limit 1];

if (?citizen is not empty?) {
   
}
I'm wanting to create an apex page that will allow users to export contacts into another program, called BBP.

The problem is that each users has their own username and access key that the apex page needs to use to allow them to add a contact to BBP. I don't want the users to have to enter their username and access key each time they export a contact. So I'm wondering how I can store the username and accesskey for each user somewhere in the salesforce account.

I have read through the entire 'salesforce_apex_language_reference.pdf' and 'salesforce_pages_developers_guide.pdf' books but was not able to find anything that would allow me to store settings like that. The best I could find was in the 'ExampleController' code snippet that was demonstrating the difference between transient and non-transient variables. But non-transient variables appear to be erased when the sessions is closed ( ie user logged out or closed browser window ).




I have an s-control that uses the AJAX proxy remoteFunction to connect to an external URL.  It has been working correctly for several months.  Over night the remoteFunction stopped working and only returns a read timeout error.
 
"400 Unable to forward request due to: Read timed out"
 
 I have eliminated and/or tested all of the other factors: connection to external site, browser, data error, IP address whitelists, etc.  I have tried using version 11 and 12 of the API.  I have also contacted the Sales Force support line with no avail.  I know that this can occur when Sales Force slows down, but it has never happened for this long 12+ hours.
 
I am left to assume that some issue with Sales Force occurred over night.  Any Ideas?
 
Code:
function postRequest(envelope) {

 sforce.connection.remoteFunction({
  url : "https://<deleted>",
  requestHeaders: {
   "Content-Type":"application/x-www-form-urlencoded; charset=utf-8"
  },
  requestData: envelope,
  method: "POST",
  onSuccess : postSuccess,
  onFailure : postFailure
 });

}