• virtcoud
  • 25 Points
  • Member since 2008

  • Chatter
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 11



Data is being retrieved from an external system and loaded into Salesforce using PHP toolkit (upserts) but the API requests limit is exceeded. The current limit on the organization is 12,000 and the volume of data to be loaded may exceed 100,000.


Even though records are added in arrays and the upsert operation is applied on the array, API requests is accounted for each record.


Is there a way to optimize the calls in PHP ? What are the possible solutions ?


Thank you for your help



I was able to search and look at my results yet the search result got munged somewhat and the data clumped in an "any" field.  I followed the instructs I found here to tweak the Partner Toolkit and it corrected the problem?  




Has anyone else noticed this?  


Any official comments from SFDC? 





Anyone have information on how to use sfdc to connect real-time into a client network to retrieve data that would be displayed to a user. 

Save Email created with email template on opportunity - I use trigger on lineitem that calls a class to send email.

In that class i want to save the email to opportunity as attachment. I need this so the salesrep can edit the sent mail and resend the mail, if something is missing.  Please need help.

I have some logic that relies on the Last Modified Date of an SObject and so in my tests need to create objects where these dates reliably differ. Given that AFAIK there is no sleep method available I am using the code below to idle away time but would be interested to know if anyone has found a better approach e.g. an API call that reliable takes many milliseconds to execute and so provides a better "delay per script statement" ratio?





private static void delayUntilTimeChanged() {

    Integer msPerS = 1000;
    Datetime start = Datetime.now();
    Datetime current = Datetime.now();

    // No sleep available so this ugliness
    Integer counter = 0;
    while ((current.getTime() / msPerS) == (start.getTime() / msPerS)) {
        // This code takes about 250ms or more on na3
        Long t1 = System.currentTimeMillis();
        String bigRandomString = '';
        for (Integer i = 0; i < 2000; i++) {
            bigRandomString += Crypto.getRandomLong();
        for (Integer i = 0; i < 50; i++) {
            Blob cryptoKey = Crypto.generateAesKey(256);
            Blob data = Blob.valueOf(bigRandomString);
            Blob encryptedData = Crypto.encryptWithManagedIV('AES256', cryptoKey, data);
            Blob decryptedData = Crypto.decryptWithManagedIV('AES256', cryptoKey, encryptedData);
        Long t2 = System.currentTimeMillis();

        System.debug('>>> delayUntilTimeChanged delayed for ' + (t2 - t1) + ' ms'
                + ', Count ' + counter
                + ', ScriptStatements ' + Limits.getScriptStatements() + ' of ' + Limits.getLimitScriptStatements()
                + ', CpuTime ' + Limits.getCpuTime() + ' of ' + Limits.getLimitCpuTime()
        current = Datetime.now();


Hi all,


which might be the preferred approach (data replication / out bound messaging) when we need to copy some fields of Account data to our external service running .Net 4 web service? Problem we have with outbound messaging is that the Salesforce user must be able to trust that a) the data he/she just modified and saved in SF actually was saved to the external service or b) if something went wrong, that must be somehow indicated to the user (and currently is not).


So, is there a way to inform the SF user if something went wrong with the outbound message (for example an exception occurred in the web service)? Checking "Monitoring" -> "Outbound messages" queue is not sufficient.


If not, then I believe we must use data replication, data consistency in SF and in our external system is a critical issue. Or is there another known pattern for resolving this kind of issue?

  • January 27, 2012
  • Like
  • 0

We need to put two dashboards together in one email, and send to a number of addresses that are contained in a custom field in a custom object. 


I am somewhat versed with apex and visualforce so if that is the way to go I guess we can manage, but I really dont know where to start?



Data is being retrieved from an external system and loaded into Salesforce using PHP toolkit (upserts) but the API requests limit is exceeded. The current limit on the organization is 12,000 and the volume of data to be loaded may exceed 100,000.


Even though records are added in arrays and the upsert operation is applied on the array, API requests is accounted for each record.


Is there a way to optimize the calls in PHP ? What are the possible solutions ?


Thank you for your help



I have several problems using Google Visualization in IE8. 


1. The Guage Visualization will not display at all, but, displays fine in Firefox.

2. I can't get any of the Event handlers (select or mouseover) to work, but again, they work in Firefox. 


I have created a Google Visualization Dashboard in a VF page.  I currently have 3 bar charts, one pie chart, and one guage on the page.  I found that I had to use CSS in the component and VF page to align the Guage.


In the Guage component, I added table.center {margin-left:auto; margin-right:auto;} to the Style tag and <table class="center">.  In the VF Page, I used a <div style="Width:500px; background:#CCCCCC;"> around the Guage component to match the width and backgroundcolor parameters  I used in the other charts.


I found that even though I have the mouseover event enabled in all the components, it only works for the last chart on the page in FF.


I also noticed that there may be a bug in the Google Pie Chart, as, it will not display a label if the value is zero.  The documentation states that is will display all labels. I even passed zero in both the pieJoinAngle and pieMinimalAngle, though they default to zero.

  • October 21, 2009
  • Like
  • 0
Hi all,

I am new for Apex development. So please help me out. Any help will be appreciable.
Currently I am using a function in our application in which I am retrieving data from external web services and storing it in Salesforce database. I am calling this function in a ‘for’ loop because this is getting called multiple times based on the selection of checkboxes. At 1st time, this function is working properly but 2nd time, It's giving exception which is as follows:
ERROR: System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out.

Below is the function which is getting called multiple times:
WebService static void getContent(String id)
    String response = '';
    Http h = new Http();
    HttpRequest req = new HttpRequest();
    String url = 'url of the web service';
    HttpResponse res=null;
    try {
        res= h.send(req);
    } catch(System.CalloutException e) {
    System.debug('ERROR: '+ e);


I am trying to automatically submit a record for approval in a visualforce page but hitting some problems.  I tried following the Apex Approval Processing example (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_process_example.htm) but I get this error:

System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval 
process found.

So I thought I needed to create a ProcessInstance but trying to insert this results in:

System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, 
Required fields are missing: [ProcessDefinitionId, CurrentNodeId]: [ProcessDefinitionId, CurrentNodeId]

I have set up an approval process for my custom object and it is active so that doesn't seem to be the problem.  This is a controller extension for my VF page and the 'record' variable is the object that has been passed into the page.  Here is my function that uses the submit for approval :

public void SubmitApproval()
/* Attempting to set up a ProcessInstance
ProcessInstance approvalProcess = new ProcessInstance(); approvalProcess.TargetObjectId = record.Id; //approvalProcess.ProcessDefinitionId = ; approvalProcess.Status = 'Started'; //approvalProcess.CurrentNodeId = ; //insert approvalProcess;

// Create an approval request
  Approval.ProcessSubmitRequest approvalRequest = new Approval.ProcessSubmitRequest(); approvalRequest.setComments('Testing Approval Submit'); approvalRequest.setObjectId(record.Id); Approval.ProcessResult approvalResult = Approval.process(approvalRequest); if (!approvalResult.isSuccess()) { ApexPages.Message error = new ApexPages.Message(ApexPages.Severity.ERROR, 'There was an error with the Submit For Approval Request.'); ApexPages.addMessage(error); } }

Edit:  Just a quick update.  If I submit the record for approval using the normal way I can then create a commandButton that approves the pending request.  This approval doesn't run into any problems at all.  I must be missing something from my Submit request.

Message Edited by XactiumBen on 06-24-2008 03:21 AM

Message Edited by XactiumBen on 06-24-2008 03:50 AM
Professional version with API
We have a custom button with exec javascript that validates a series of fields based on the user´s role before they can submit the Opp for approval by their Sales Mananger. All the standard validation works great and has been easy to access and program however I cannot figure out how to access the Opportunity Contact Role object from the native options within Salesforce to validate that a Role has been chosen, the Primary has been set, etc . . .
Futhermore there is no way create any valildation rules on the Opportunity Contact Role field directly or indirectly. For example if I wanted to create a validation rule on the Stage field that checks to see that the "Primary" contact has been chosen from all the contacts on the Opportunity Contact Role object when the Stage has been set to "Sold" there is no way to query the checkbox value on the "Primary" field.
What we want to accomplish is that no Sales Order goes forward without the "roles" of all the Opportunity Contact Roles being define and without a "Primary" chosen from all the contacts.
Does anyone have any ideas how this can be done?
thanks, crmzepher