• TSH53
  • NEWBIE
  • 30 Points
  • Member since 2009

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

Hi All,

 

I want to write TestMethods for Standard salesforce classes XMLDom & Start here controller. Can any one explain me what is the use of those classes? I written testmethods for all my triggers & classes and got 72%, the code not covered is only Xmldom & starthere controller classes.

 

   Can we delete these classes?

 

Thanks,

Aswath.

  • March 22, 2009
  • Like
  • 0

I have a trigger for the Contact object (before insert, before update) that works perfectly in all situations I have tested so far - except for one. When I attempt to use the 'Mass Update Addresses' feature to update a country or state/province field, my trigger is not called. The wizard nicely informs me that it is going to update the appropriate field on the Contact record, but then never calls my Contact trigger.

 

Is this because somewhere behind the scenes it is updating the address information in another physical location (say an internal address table) instead of fields directly on the contact object itself? This is the only rationale I can think of for this behavior.

 

Can anyone shed some light on the situation for me?

 

This is pretty problematic for me since the trigger needs to do some important stuff whenever the value in the state/province or country field changes.

 

Thanks in advance for any assistance you can provide.

  • March 11, 2009
  • Like
  • 0

Is Connect for Outlook available in the Developer Edition?

If not, why not?

 

How can someone with a Developer Edition become experienced with the product in order to advise a client?

  • February 12, 2009
  • Like
  • 0

Having alittle challenge in building multi dimensional lists and maps for a bulk processing class.  This is being designed to handle thousands of records, and given the limitations of 1000 members per list or per map I have chosen to handle by creating multiple lists and maps to address this.

 

Current code frag I am working on is indicating that I have a List Index out of Bounds:

 

List<List<OpportunityTeamMember>> otm = new List<List<OpportunityTeamMember>>();

List<Map<string,OpportunityTeamMember>> oppMap = new List<Map<string,OpportunityTeamMember>>();

 

j = 0; 

 

for(OpportunityTeamMember opt: [Select o.id, o.opportunityid, o.teammemberrole, o.opportunityaccesslevel, o.userid,

o.Opportunity.accountid From OpportunityTeamMember o where o.Opportunity.accountid in :accIds and isDeleted = False

and userid in :userIds])

  {

   j = setOffset(i);       //  sets the variable j up by 1 for each 1000 records read to move to next list array

   opplist[j].add(opt);  //  adds the record read to the list

 

   i++;                      //  increment the record count

 }

 

// Now, build maps from each list and construct a compound key

 for(j=0; j<10; j++)  {

    for(OpportunityTeamMember ox1: opplist[j])  {      oppMap[j].put(ox1.userid +

':' + ox1.Opportunity.accountid + ':' + ox1.opportunityid, ox1);

   }

In looking at the debug log it shows that the code fails on the first iteration through the for select loop after reading the record and that the setOffset(i) is returning a zero as expected.  The code doesn't make it to the map building phase, but I would assume that there will be a similar issue there as well.

 

I am assuming that I am not dereferencing the list properly, or that I am not creating it properly, or both.  Any assistance would be appreciated. 

Hi All,

 

I want to write TestMethods for Standard salesforce classes XMLDom & Start here controller. Can any one explain me what is the use of those classes? I written testmethods for all my triggers & classes and got 72%, the code not covered is only Xmldom & starthere controller classes.

 

   Can we delete these classes?

 

Thanks,

Aswath.

  • March 22, 2009
  • Like
  • 0

Hello All,

 

I'm working on a solution in a trigger where I need to access the entire hierarchy of parent accounts for a given account.  At the moment, I'm recursively querying the account table for each account's Parent based on ParentId.  

 

This solution is fragile because if there were enough parent account to child account layers, then the trigger would hit the query limit.

 

Is there a way to access data about accounts at each level in a hierarchy without recursive querying?  It would be splendid if I could run a single query and get back a Map of Accounts or something along those lines.

  


private static string getTopParentAccountName(Account thisAccount) {
if (thisAccount.ParentId != null) {
// Get the parent account for this account and pass it to this function for recursion
Account parentAccount = [Select a.ParentId, a.Name, a.Id From Account a where a.Id = :thisAccount.ParentId];
return getTopParentAccount(parentAccount);
}
else { // There's no parent account
return thisAccount.Name;
}
}

 

The code above is representative of the logic I'm employing.  (This isn't the actual code I'm using, it's something I worked up to illustrate my point, so please ignore any minor errors in the code.) 

 

I checked the Apex Relationship Queries Documentation and found the following comments that seem relevant:
  • In each specified relationship, no more than five levels can be specified in a child-to-parent relationship. For example, Contact.Account.Owner.FirstName (three levels).
  • In each specified relationship, only one level of parent-to-child relationship can be specified in a query. For example, if the FROM clause specified Account, the SELECT clause could only specify the Contact or other objects at that level. It could not specify a child object of Contact. 
 
Any thoughts on how to handle this situation and get around the governor limitations?     
 
All input is appreciated!
 
Cheers,
-Philip

Hi,

 

I have this trigger and it’s not functioning for bulk update (data loader update). I get the "System.Exception: Too many SOQL queries" error.

 

I need to modify this code to work in bulk . I am new to Map & Set. Can any one please help me to modify this code to handle bulk update.

 

 trigger deleteOppContRole on Opportunity (after update) {

 

    for (Integer i = 0; i < Trigger.old.size(); i++) {
        try {


        for (Account acc : [select PersonContactId from Account where id = :trigger.new[i].AccountId])
           {
            
            OpportunityContactRole [] oDWs =

                                      [select id from OpportunityContactRole where OpportunityId = :trigger.new[i].id and ContactId=:acc.PersonContactId ];
          
     

            if (oDWs.size() > 0)
             {
             delete oDWs;
             }
           
            }
           
        } catch (System.QueryException ex) {
            //Do Nothing - There must not have been any to delete.
        }
    }
}

 

Thanks for your help.

Message Edited by das on 03-20-2009 03:15 PM
Message Edited by das on 03-20-2009 03:16 PM
Message Edited by das on 03-20-2009 03:18 PM

I have a trigger for the Contact object (before insert, before update) that works perfectly in all situations I have tested so far - except for one. When I attempt to use the 'Mass Update Addresses' feature to update a country or state/province field, my trigger is not called. The wizard nicely informs me that it is going to update the appropriate field on the Contact record, but then never calls my Contact trigger.

 

Is this because somewhere behind the scenes it is updating the address information in another physical location (say an internal address table) instead of fields directly on the contact object itself? This is the only rationale I can think of for this behavior.

 

Can anyone shed some light on the situation for me?

 

This is pretty problematic for me since the trigger needs to do some important stuff whenever the value in the state/province or country field changes.

 

Thanks in advance for any assistance you can provide.

  • March 11, 2009
  • Like
  • 0

Is Connect for Outlook available in the Developer Edition?

If not, why not?

 

How can someone with a Developer Edition become experienced with the product in order to advise a client?

  • February 12, 2009
  • Like
  • 0
Since using the new release of the IDE (version 14) I get enormous amounts of debug output, no matter what log level are set. These settings seem to get ignored, the same seems to happen in the browser output when running tests.
I set the various log levels for each category, basically disabling everything except apex code, but each test case gets several thousand (!) lines of output. So the debug log only contains output for 3 test methods before all further output gets truncated.
This makes it pretty much impossible to use the output for debugging since it misses most of the other test methods and is totally bloated with information I didn't want to see in the first place.
Any ideas what's going on here? Are the log levels just broken? Anything I can do to get useful debug log output?
When Apex code was first released the debug log worked wonderfully! It displayed all relevant Apex info, limits, debug statements, etc.

The new version not so much. When I am working with Apex code I could care less about workflow criteria evaluations. These do nothing but get in the way and make the debug log ridiculously long. For us this is making the debug log so long it is cutting off the top of the log and with that lots of my debug statements. This has made debugging Apex extremely tedious and very painful.

With the new version you are supposed to be able to modify the logging level but this rarely works. It's as if it has a mind of its own.

Sorry for the somewhat harsh tone but it has been very frustrating digging through literally 35,000 lines of workflow evaluations only to find that my debug statements are not there.



Message Edited by TehNrd on 07-17-2008 03:34 PM