function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CKNCKN 

Trace files in SalesForce - for debugging

Hi,

Just wondering if there are any system generated trace files in SFDC which might help with debugging or troubleshooting any code related issues.

 

aalbertaalbert

Here is the documentation on debugging apex.

gv007gv007

Albert,

           I am not able find the link .Can you post m,e the right link.

Thanks

Gopi

gv007gv007

Where writing code please put possible System.debug () statements in the code.

2.Try to print the exception in the log do't leave it.It will helpful upto some extent.

aalbertaalbert

Sorry about the link not working. Go to the Apex Developer Guide here: http://www.salesforce.com/us/developer/docs/apexcode/index.htm. Then click on the sub section titled "Debugging Apex".

CKNCKN

Thanks Gopi and Albert,

I am a newbie to Apex and trying to debug the code written by previous developers.  Some of the triggers are giving index out of bound error and I am trying to troubleshoot. I am unable to recreate the scenario that causes the error so wondering what the best approach would be.

Chitra

aalbertaalbert

When does it throw the 'out of bounds' error? During an API transaction (data load, integration, ect)? Or do end-users report it when they are in the UI?

 

An out of bounds error usually refers to the code accessing an item in a collection (array, list, set, map) that doesn't exist.

 

Also, make sure the code has sufficient System.debug() statements to help you read the Debug Logs.

CKNCKN

Getting the out of bound error when doing an insert in the account object and I checked the recordids and they both exist.

 

 

system.debug(searchnames);
        if(!SearchNames.isempty())
        {
          for(Account b:[select id, name, OwnerId, Affiliation__c, Master_Account__c from Account where name in :SearchNames and (recordtypeid = '01240000000M1ugAAC' or recordtypeid = '01240000000M1uWAAS')])
          {
            HierarchyAccounts.put(b.Name, b);
          }
        }
        system.debug(hierarchyaccounts);

aalbertaalbert

How many records are returned in the soql query? How many records are in the HierarchyAccounts collection? Are you inserting a null object?

 

I recommend adding more System.debug statements to see more details of the code execution.