• Ryley Hayes
  • NEWBIE
  • 10 Points
  • Member since 2014
  • Salesforce Administrator
  • Napoleon Products

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

We have an intergration using the command line dataloader, version 23. Today it suddenly stopped working, giving an error "failed to send request to https://na14.salesforce.com/services/soap/u/23.0/...”

If I try to log in with Apex Data Loader v23, I get the same error message.

However, if I log in with a later verison of Apex Data Loader, v29, there's no problem.

Unfortunately, I can't just switch versions with the integration.

Weirdest of all, the failed logins still show up in Salesforce in the login history as successful, even though they really aren't. 

I have an App Level Consoler Component (the ones in the footer), which is just a basic VisualForce page with Javascript from the Console Integration Toolkit.

<apex:page>
<apex:includeScript value="/support/console/22.0/integration.js"/>
<script type="text/javascript">
function OpenPrimaryTab() {                              
               sforce.console.openPrimaryTab(null, 'http://www.salesforce.com', true, 'salesforce');
          }
</script>
<apex:form>
<apex:commandButton value="New Contact" onclick="OpenPrimaryTab()"/>
</apex:form>
</apex:page>

Clicking that button from the Console Component does nothing though.
I have a trigger on task, after insert and update, which is supposed to then go to a related Case and update a "last activity" field on Case.
The code seems to work. The Last Activity field on Case does get updated... usually. Maybe about 5% of the time, it doesn't happen. Trigger code below:
 
trigger NewTaskTouchParentObject on Task (after insert, after update) {


    for (Task tsk:System.Trigger.new) {
            if(tsk.WhatId != null){
            system.debug(tsk.WhatId);
            String whatId = tsk.WhatId;
            String whatIdPrefix = whatId.substring(0,3);
            
            ApexDebug__c Debugger = new ApexDebug__c(Log__c= 'WhatID = '+ WhatID + '\n' + 
                                                    'WhatIdPrefix = ' + WhatIDPrefix + '\n' +
                                                    'Status = ' + tsk.Status + '\n' +
                                                    'AutoResponse = ' + tsk.Is_Autoresponse__c +'\n');
                
           
                        
            if (whatidPrefix.equalsIgnoreCase('500') && tsk.Status == 'Completed' && tsk.Is_Autoresponse__c == False) {                                
                                                                          
                //Updates case field when an activity is added
               
                Task MostRecentTask= [select ActivityDate, Type from Task where WhatId = :tsk.WhatID AND Status = 'Completed' ORDER BY ActivityDate DESC NULLS LAST LIMIT 1];
                    Debugger.Log__c = Debugger.Log__c + 'MostRecentTask.ActivityDate = ' + MostrecentTask.ActivityDate + '\n' + 'MostRecentTask.Type = ' + MostRecentTask.Type + '\n';
                Integer TaskCount = [select COUNT() FROM Task where WhatId = :tsk.WhatID AND Status = 'Completed' AND Is_Autoresponse__c = false];
                    Debugger.Log__c = Debugger.Log__c + 'TaskCount = ' + TaskCount + '\n';
                If(tsk.ActivityDate >= MostRecentTask.ActivityDate || MostRecentTask.ActivityDate==null){
                    Case acc = new Case(Id=tsk.WhatId, Last_Activity__c=tsk.ActivityDate, Last_Activity_Type__c = tsk.Type, Number_of_Complete_Activities__c = TaskCount);
                    //casesToUpdate.put(tsk.WhatId, acc);
                    Database.SaveResult srs = database.update(acc);
                    Debugger.Log__c = Debugger.Log__c + 'acc.id = ' + acc.id + '\n' + 'acc.Last_Activity__c = ' + acc.Last_Activity__c + '\n' + 'If Statement = 1' +'\n' +srs.success +'\n' +srs.errors;
                    
                    }
                else{
                    Case acc = new Case(Id=tsk.WhatId, Last_Activity_Type__c = MostRecentTask.Type, Number_of_Complete_Activities__c = TaskCount);
                    Database.SaveResult srs = database.update(acc);
                    //casesToUpdate.put(tsk.WhatId, acc);
                    Debugger.Log__c = Debugger.Log__c + 'acc.id = ' + acc.id + '\n' + 'acc.Last_Activity__c = ' + acc.Last_Activity__c + '\n' + 'If Statement = 2' +'\n' +srs.success +'\n' +srs.errors;}
                    
                
                }
            insert Debugger;
          }            
     }       
}

As you can see, I have some custom debugging in there. An example debug log from a case that did not update:
 
WhatID = 500d000000OsEfzAAF
WhatIdPrefix = 500
Status = Completed
AutoResponse = false
MostRecentTask.ActivityDate = 2015-01-23 00:00:00
MostRecentTask.Type = Email
TaskCount = 1
acc.id = 500d000000OsEfzAAF
acc.Last_Activity__c = 2015-01-23 00:00:00
If Statement = 1
true
()
As you can see, acc has both an id and date populated. The 'true' at the end is from the update SaveResults.Success, the '()' is from the update SaveResults.Errors... so the values are present in the sObject being updated, and the update is apparently occuring successfully with no errors. And yet, it isn't actually happening... the Last Activity field remains blank on the case.

Debug logs from successes look the same. There doesn't seem to be any pattern to the instances where the update doesn't take. The same users have successes and failures alike. There isn't another process running after this updating the field again back to blank... this trigger and its test class are the only places the field is referenced. I'm stumped.
I'm attempting to find the "first" selected value in a multi-select picklist, and pass it into another field. I thought it would be fairly simple to do this - just take the string that the multi-select gets stored as, find the position of the first semicolon using indexof, then take everything before it using substring(0,firstsemicolon). And it works... sorta. The result is a single value from the selected values. But it's not the first value. To troubleshoot, I removed the indexof and substring and just wrote the value of the multi-select straight into the other field. So now I've got:

public class CaseFirstSymptom{
    public static void Symptoms (Case[] SymptomCases){
        for( Case SymptomCase : SymptomCases) {
            string FirstSymptom = SymptomCase.Symptoms__c;
            SymptomCase.First_Symptom__c = FirstSymptom;
        }
    }
}
On a record, I select the following values, and see this string displayed for that field after saving:
Complete (Pilot & Burner) Outage; Delayed Ignition; Does Not Light; Flare-Ups/Uneven Heat; Low Heat/Low Flame; Outage; Pressure Not Changing

The "target" field winds up displaying this:
Delayed Ignition;Complete (Pilot & Burner) Outage;Pressure Not Changing;Low Heat/Low Flame;Does Not Light;Outage;Flare-Ups/Uneven Heat

The values are all the same, but the order is changed.

I've got the picklist values in alphabetical order. I'm wondering if the values are ordered by ID or something though when you use that field in Apex. Anyone know for sure? And if so, anyone know a way around this?
I have an App Level Consoler Component (the ones in the footer), which is just a basic VisualForce page with Javascript from the Console Integration Toolkit.

<apex:page>
<apex:includeScript value="/support/console/22.0/integration.js"/>
<script type="text/javascript">
function OpenPrimaryTab() {                              
               sforce.console.openPrimaryTab(null, 'http://www.salesforce.com', true, 'salesforce');
          }
</script>
<apex:form>
<apex:commandButton value="New Contact" onclick="OpenPrimaryTab()"/>
</apex:form>
</apex:page>

Clicking that button from the Console Component does nothing though.