• El_Dev
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Can someone help us with some script and a web method that will create a button for a Large and/or Medium sized organization to push out tasks to the field sales.  There would be a few thousand tasks distributed so Apex is required as well as some Java.
 
thx/El
  • January 02, 2008
  • Like
  • 0
Can someone help us with some script and a web method that will create a button for a Large and/or Medium sized organization to push out tasks to the field sales.  There would be a few thousand tasks distributed so Apex is required as well as some Java.
 
thx/El
  • January 02, 2008
  • Like
  • 0
I am building a fairly complex set of apex triggers and classes that does the following:
  • Automatically create a custom object (household) whenever a Contact is created
  • Keep that custom object in sync with the Contact as it changes
  • Automatically create Contact roles on Opp insert when you flag the Contact in the data
  • Create contact roles automatically for other Contacts connected to the primary contact's household
  • Roll up Opportunity amounts to the Contact that is primary contact role, and household members
We've built out a bunch of triggers, classes and tests. We've done lots of bulk testing, and think we understand how batches work, and how that affects the various governor limits. We can't test all scenarios that we might see in the data--there are limits to how large the test batches can be which makes it impossible to predict how large batches will behave.

When doing rollups like we're doing, we end up getting lots of data. Each opp we insert has one primary contact role, which could have 10 opportunities, and those opp ammounts need to be rolled up to that contact and the couple other contacts in it's household.

When we run across contacts that are primary on a lot of opps, we're running into script execution limits and heap size limits. These limits seem way too low if we're hitting them with 200 contacts that have a total of 300 opporunities we want to roll up. We've done some refactoring to avoid loops inside of loops to keep execution down.

I have found through trial and error that I can reduce the number of errors by turning the batch size down to 100 or 50. This is much slower, but stays below the governor limits. But even at a batch size of 50 opps being inserted, I'm still going over my heap size in some cases.

I've also run into one problem where my code for adding Contact Roles on Opp insert doesn't add contact roles to all opps at a large batch size, but does at a smaller batch size. The alarming thing is that no Apex errors are thrown during the import process, leading me to believe my code is executing correctly. If udates were failing, or a list was too large, or too many DML or SOQL statements, I would expect an error. We're stumped on this one right now.

I know complex code situations like mine surely can't be diagnosed over these boards, so I'm writing this more to express concern about the utility of Apex for more complex coding like we're trying to do. Dealing with batches, navigating the landscape of these low governor limits, not being able to write tests for real-world situations, seemingly not getting errors when I expect them are all concerning to me. We're really excited about Apex, but the learning curve and now the reality that we may not be able to do much of what we want to do becuase of low governor limits is getting us down right now.

Any thoughts would be appreciated!

Steve

Hi, in this case I´d like to know 2 things. According to the next query, I need to establish the list of campaigns that are NOT related to a custom object where we have a search field related to campaign object. Their relationship is something like this:
 
Campaign - one to many = MyCustomObject__c
 
Here is the query:
Code:
Select c.Id, c.Name, c.CustomFieldA1__c, c.CustomFieldA2__c, (Select CustomFieldB__c From MyCustomObject__r) from Campaign c where c.RecordTypeId=:MyOwnRecordType

 That query returns ALL CustomFieldB__c values asociated to every campaign, but what I really need is to get ONLY, the list of campaign that are not included in the child object. something like a LEFT OUTER JOIN.
 
And the second question is according to the given query, how could read the value of CustomFieldB__c by using ApexCode?
 
Regards,
 
WILMER
 
  • November 15, 2007
  • Like
  • 0