• JoeK.ax278
  • NEWBIE
  • 0 Points
  • Member since 2007

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

just now.  *http://wiki.developerforce.com/index.php/BNF_FOR_SOQL)

I was hoping this line:

FIELDEXPR ::= NAME OPERATOR VALUE | NAME MATHOPERATOR NAME OPERATOR VALUE

Indicated we could now do this:

    select id from object where x -  y > 0

as an alternative to

    select id from object where x > y

Is there an enhancement to SOQL that I've missed or that is in the works?

 

On at least two different occassions I've seen sporadic errors running stateful, batchable Apex jobs.   Yesterday I was able to observe the problem in debug logs in my dev org.  

 

The errors I've seen so far, have included:

 

* Unable to write to any FileForce Server within the specified timeout

* Unable to fetch <<long key containing pathname and three different SFID's>> from any FileForceServer

* Read Timed Out


I have a screen shot of the debug log listing showing error batches mixed with successful batches and screen shots of a sampling of the logs for error batches.

Today the code has been running error-free in my dev org.

Thanks for your help,

Think & Enjoy -- Joe Krutulis

Message Edited by JoeK on 11-13-2009 03:53 PM
Salesforce is generating the following outbound SOAP message to a legacy web service.

Salesforce leaves the <getAccountInformationRequest> element in the http://purolator/channelintegration/accountservice/ Namespace, but the legacy service expects this element to be in the http://purolator/channelintegration/business.entities namespace.

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Header/>
<env:Body>
<GetAccountInformation xmlns="http://purolator/channelintegration/accountservice/">
<getAccountInformationRequest>
<AccountNumber xmlns="http://purolator/channelintegration/business.entities">4381</AccountNumber>
<AccountDetailsRequiredIndicator xmlns="http://purolator/channelintegration/business.entities">Y</AccountDetailsRequiredIndicator>
<ChannelIntegrationRequestInformation xmlns="http://purolator/channelintegration/business.entities">
<RequestVersion>1.0.0.30</RequestVersion>
<RequestLanguage>En</RequestLanguage>
<TransactionGroupID>?</TransactionGroupID>
</ChannelIntegrationRequestInformation>
</getAccountInformationRequest>
</GetAccountInformation>
</env:Body>
</env:Envelope>

 

Here's the relevant snippet of the WSDL from which the Apex classes were generated:

 

...
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://purolator/channelintegration/accountservice/">
<s:import namespace="http://purolator/channelintegration/business.entities" />
<s:element name="GetAccountInformation">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" ref="s1:getAccountInformationRequest" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetAccountInformationResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" ref="s1:GetAccountInformationResult" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
<s:schema elementFormDefault="qualified" targetNamespace="http://purolator/channelintegration/business.entities">
<s:element name="getAccountInformationRequest" nillable="true" type="s1:GetAccountInformationRequest" />
<s:complexType name="GetAccountInformationRequest">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="AccountNumber" nillable="true" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="AccountDetailsRequiredIndicator" nillable="true" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="ChannelIntegrationRequestInformation" nillable="true" type="s1:RequestInformation" />
</s:sequence>
</s:complexType>
<s:complexType name="RequestInformation">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="RequestVersion" nillable="true" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="RequestLanguage" nillable="true" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="TransactionGroupID" type="s:string" />
</s:sequence>
</s:complexType>
<s:element name="GetAccountInformationResult" nillable="true" type="s1:GetAccountInformationResponse" />
<s:complexType name="GetAccountInformationResponse">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="Account" nillable="true" type="s1:Account" />
<s:element minOccurs="1" maxOccurs="1" name="ChannelIntegrationResponseInformation" nillable="true" type="s1:ResponseInformation" />
</s:sequence>
</s:complexType>
...

 

The reading I've done so far seems to point toward this: elements ref'ing an imported namespace should themselves be in the imported namespace not the importing namespace -- which would agree with the legacy service.  I've not yet been able to confirm this myself in the w3c schema spec.

See, for example, this explanation from the folks at sun: http://developers.sun.com/jsenterprise/archive/nb_enterprise_pack/reference/techart/namespaces2.html

Is this a result of an ambiguity in the spec, or perhaps a salesforce bug?

Does anyone have a way to modify the generated classes or to hack the wsdl to move the <getAccountInformationRequest> to the required namespace?

 

Thank You! -- JoeK

 

 

The following line of code:

>
> global class zzz_Test {public static testMethod void testDoNothing(){Test.startTest();}}
>

generates a compiler error in one of my Summer '08 sandboxes:

Error: Compile Error: Method does not exist or incorrect signature: Test.startTest() at line 1 column 70

It compiles fine in my dev org and in a different Summer '08 sandbox.

Has anyone seen this or similar problems? Am I missing some new config or setting pertinent to Test methods?

Thank you,
Joe Krutulis

(Note: I have submitted this as case 01881422)

Contact Duplicate Trigger:

 

I've got the general idea on this, but my multiple conditions for the where clause are not working.  I need it to throw the error either if the email address matches or if the first name, last name, and one of the phone numbers match.  Parentheses don't seem to be helping drive the logic.  Who can give me some guidance here?

 

When I use this code it throws the error if the first and last name match regardless of whether there is a match on one of the phone numbers.  But I want it to only throw the error if a the full name and one of the phone numbers match an existing contact record.

 

trigger ContactDuplicateTrigger on Contact (before insert) {
for (Contact c : Trigger.new){
Contact[] contacts= [select id from Contact where
    ((FirstName = :c.FirstName and LastName = :c.LastName) and
    (Phone=:c.Phone or MobilePhone=:c.MobilePhone or HomePhone=:c.HomePhone or OtherPhone=:c.OtherPhone or Home_Phone_2__c=:c.Home_Phone_2__c)
)    or Email = :c.Email];
if (contacts.size() > 0) {
c.LastName.addError('Contact cannot be created - Contact already exists with the same email or name-phone combination.');
}
}
}

On at least two different occassions I've seen sporadic errors running stateful, batchable Apex jobs.   Yesterday I was able to observe the problem in debug logs in my dev org.  

 

The errors I've seen so far, have included:

 

* Unable to write to any FileForce Server within the specified timeout

* Unable to fetch <<long key containing pathname and three different SFID's>> from any FileForceServer

* Read Timed Out


I have a screen shot of the debug log listing showing error batches mixed with successful batches and screen shots of a sampling of the logs for error batches.

Today the code has been running error-free in my dev org.

Thanks for your help,

Think & Enjoy -- Joe Krutulis

Message Edited by JoeK on 11-13-2009 03:53 PM

I'm integrating Salesforce opportunities to an internal network enterprise application.  To enable this integration (Apex Callout), will the enterprise application or target middleware need to be exposed to the internet?  If so, what is the best way to do this?

 

Also, I will need to create a Salesforce Web Service which can be called by the internal application.  I have created a sample one that works, however; my internal development partner would like me to modify the resulting WSDL to accept data in the exact format they are currently publishing it.  They have a company standard I need to adapt.  Without introducing middleware, is it possible for me to modify my web service to accept "exactly" what they are sending?  Also, is their any way I cannot require them to execute the Login method and retrieve a Session ID or is this always required?

 

I have a sample of their xml if that helps.

 

Any feedback will be appreciated!

 

Thanks!

I have an after insert trigger on a custom object. The trigger calls a future method (a method defined with @future), passing in Trigger.newMap.keySet().

 

When I run unit tests that insert records into the custom object, the trigger does its job just fine. The unit tests confirm that the future method does its work and creates some records for a different object.

 

However, when I use the Execute Anonymous window in the IDE to run the same code (I literally copied the code from the unit test and pasted it into the Execute Anonymous pane), the Apex code completes without error, but then I get an email message that says "System.AsyncException: Failed to enqueue future method." The same thing happens when I cause the trigger to fire by inserting records into the custom object through a custom JavaScript button on a standard page in the browser.

 

I commented out the line in the trigger that calls the future method (I'm running in a development org), inserted the records into the custom object, then ran some anonymous Apex code that builds a Set of the new record IDs and calls the future method. That runs just fine -- no email message, and the future method does its work.

 

The code is pretty simple. The trigger simple does something like:

 

myClass.myFutureMethod(Trigger.newMap.keySet());

 

And the method is simply defined:

 

global class myClass { @future public static void myFutureMethods(Set<Id> setIds) { .....

 

For what reasons might my future method not get enqueued? Why does it get enqueued and run just fine in a unit test, but not otherwise?

 

Thanks for any insight you can provide.

  • February 21, 2009
  • Like
  • 0
The following line of code:

>
> global class zzz_Test {public static testMethod void testDoNothing(){Test.startTest();}}
>

generates a compiler error in one of my Summer '08 sandboxes:

Error: Compile Error: Method does not exist or incorrect signature: Test.startTest() at line 1 column 70

It compiles fine in my dev org and in a different Summer '08 sandbox.

Has anyone seen this or similar problems? Am I missing some new config or setting pertinent to Test methods?

Thank you,
Joe Krutulis

(Note: I have submitted this as case 01881422)
I created an Apex trigger in Sandbox.  I am now trying to deploy the Trigger using the Force.com IDE for Eclipse.  When I get to the step where I "Validate Deployment" it results in a failure.
Deployment Log:
*** Deployment Log ***
Result: FAILED

...

# Deploy Results:
 Name: unpackaged/package.xml
 Action: NO ACTION
 Result: FAILED
 Problem: Invalid version specified:12.0

Does anyone know why this is happening?  Could it be because our Sandbox was already upgraded to the Spring 08 (API version 12.0) release and our production instance wasn't yet (still API version 11.1)?
-greg
  • January 30, 2008
  • Like
  • 0
I have a simple trigger that creates a tracking record every time the owning group changes (we call this escalation group).  The purpose is to have time tracking similar to how salesforces give you time in status for  service and support cases.  However, the trigger fails with an exception if there are more than 20 records in the new_entries set.   I can work around this, but my solutions  are  seriously kludgy.  Is there a better approach I'm missing?

-Tyler

Here is the code:

trigger recordStatusDates on Case (after update) {

  List<Case_Status_Log__c> new_entries = new List<Case_Status_Log__c>();

  for( integer i = 0; i < Trigger.new.size(); ++i) {

    if (Trigger.old[i].status != Trigger.new[i].status) {
      new_entries.add(Util.buildCaseStatusLog('Status', Trigger.new[i].id, Trigger.old[i].status, Trigger.old[i].status_changed__c, Trigger.new[i].status_changed__c));
    }
    if (Trigger.old[i].escalation_group__c != Trigger.new[i].escalation_group__c) {
      new_entries.add(Util.buildCaseStatusLog('Escalation_group',
          Trigger.new[i].id, Trigger.old[i].escalation_group__c,
          Trigger.old[i].escalation_group_changed__c, Trigger.new[i].escalation_group_changed__c));
    }
  }
  insert new_entries;
}

//Copied from Util
public static Case_Status_Log__c buildCaseStatusLog(String typeOf, Id id, String value, Datetime oldDate, Datetime newDate) {
      Case_Status_Log__c csl = new Case_Status_Log__c();
      csl.case__c = id;
      csl.value__c = value;
      csl.value_type__c = typeOf;
      csl.start_datetime__c = oldDate;
      csl.stop_datetime__c = newDate;
     
      if(oldDate != null && newDate != null) {
        csl.hours_in_state__c = util.hoursBetween(
                                   csl.start_datetime__c,
                                   csl.stop_datetime__c);
      }
      return csl;
  }
Hi All,

This is my first attempt at an apex trigger so please bear with me.  I am trying to write a trigger that will update other opportunity records.  The logic is as follows.

Any Opportunity is updated.
Take EVAL_serial_num__c from updated record and search all exsisting opportunity records for matching serial numbers
    If match then update the matching opportunity's field  EVAL_Stage__c = 'Returned';

I have the following code which isn't throwing any errors but at the same time it isn't updating opportunities with matching serial number fields.

Code:
trigger evaluationUpdate on Opportunity (after update) {

 for (Opportunity opp : Trigger.new)
 {
 String serialNum;
 serialNum = opp.EVAL_serial_num__c;
 
 Opportunity[] Opps = [select ID, EVAL_Stage__c from Opportunity where EVAL_serial_num__c = serialNum];
 for (Opportunity o : Opps)
 {
  if(EVAL_Stage__c != 'Returned'){
   o.update(EVAL_Stage__c = 'Returned');
   o.EVAL_Stage__c = 'Returned';
  }
 }
}
}

Any help will be appreciated.
Thanks