SlideShare a Scribd company logo
Become a Debug Log Surgeon
Taking Your Dev Console Troubleshooting Skills to the Next Level
jess.lopez@salesforce.com, @jjjlo
Jess Lopez, NGO Technical Architect, Salesforce.org Customer Centric Engineering
Forward-Looking Statements
Statement Under the Private Securities Litigation Reform Act of 1995
This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties
materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. or Salesforce.org could differ materially from
the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could
be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other
financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any
statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with Salesforce.org or as applicable
Salesforce (referred to collectively as “we” and “our”) developing and delivering new functionality for our service, new products and
services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth,
interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed
and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to
expand, retain, and motivate our employees and manage our growth, new releases of our services and successful customer deployment,
our limited history reselling non-salesforce.com products, and utilization and selling to different market segments. Further information on
potential factors that could affect the financial results of salesforce.com, inc. is included in its annual report on Form 10-K for the most
recent fiscal year and in its quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing
important disclosures are available on the SEC Filings section of the Investor Information section of the Salesforce Web site.
Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently
available and may not be delivered on time or at all. Customers who purchase salesforce.com services or the Salesforce.com-developed
products and services should make the purchase decisions based upon features that are currently available. Salesforce.org assumes no
obligation and does not intend to update these forward-looking statements.
Step 1
Step 5
Step 4
Step 3
Step 2
NPSP /
Managed
Packages
Where might
we find errors?
Order of
Execution &
Governor
Limits
Real World
Example
Common Errors
and Strategies
for
Troubleshooting
Step 6
Agenda
The Dev
Console
Who am I?
I went to college thinking I would become a surgeon.
Who am I?
I went to college thinking I would become a surgeon.
Who am I?
Today, I’m a Salesforce.org NGO Architect in Customer Centric Engineering.
Who am I? It’s similar… kind of.
Help! NPSP is doing this really strange thing
for a customer and it’s causing them some
major pain and headaches.
Find and resolve the issue quickly!
“
”
“Surgery” “Charts” “Grand Rounds”
It’s similar… kind of.
● Capture logs and
analyze with precision
● Review NPSP
codebase
● Resolve issue;
suggest resolution to
customer; or escalate
to Product team
● Case Escalations
● Investigations
● Github Issue
“Novels”
● Case Studies
● Trainings/
Bootcamps
“Diagnose
Critical Issues”
● Run “tests” and
analyze holistically.
● Determine root
cause
NPSP & Packages
NPSP at a Glance
NPSP = Nonprofit Success Pack
Salesforce.org Product; foundation of Nonprofit Cloud
Pre-built constituent and donor management components
Built on Salesforce.com
Flexible, open data architecture
Maybe...
Core
Salesforce.com (EE or UE)
Sales Cloud | Service Cloud
SFDO
Nonprofit Success Pack Volunteers for Salesforce
Usually...
Core
SFDO
Declarative and Programmatic Customizations
Managed PackageManaged PackageManaged PackageManaged PackageManaged Package
Salesforce.com (EE or UE)
Sales Cloud | Service Cloud
Nonprofit Success Pack Volunteers for Salesforce
Marketing Cloud Communities
Understanding Packages
Unmanaged
● Editable components
● Can’t be upgraded or changed by package owner
once installed
● Can see everything about the package in debug logs
Managed
● Some components are editable; others are not.
● Fully upgradeable
● Push updates
● Can’t see many things about the package in debug
logs
Certified Managed Packages:
● On AppExchange
● Have gone through Security Review
● Get own set of limits for most per-transaction limits
(DML, Query Limits, etc.)
“A package is a container for something as small as an individual component or as large as a set of
related apps. After creating a package, you can distribute it to other Salesforce users and
organizations, including those outside your company.”
Where might we find errors?
Record-Level Errors
Email / Chatter Notifications
NPSP Settings →
System Tools → Error
Notifications
● Choose to send to
specific User, System
Admins, or Chatter group
● Typically related to our
Scheduled Jobs
Apex Jobs
Errors Custom Object
View and clear logs within NPSP
Settings → System Tools → Error
Logs
Create reports on object, too!
Order of Execution
(Super High-Level)
Validation
Before Triggers
Duplicate Rules
Save, but don’t commit
After Triggers
Assignment Rules
Auto-Response Rules
Workflow Rules
Processes / Flows
Escalation Rules
Entitlement Rules
Roll-up Summaries (parents/grandparents)
Criteria-based Sharing Rules
Commit record
Post-commit logic
Governor Limits
Limits, Allocations, and Limitations
Allocations
Edition-based
constraints
(e.g. # of Custom
Objects, # of Validation
Rules)
Limits
Concrete numeric values
assigned to
features/functionality
(e.g. Max # of Sharing
Rules)
Limitations
Expected but unavailable
functionality
(e.g. Importing
Documents in the Data
Import Wizard)
Design-Time Limits
Cross-Object Formulas
Lots of vLookup Rules per object
Picklists with lots of values
Lots of Report Filters
Sharing Rules Limits
Criteria-Based Sharing Rules
Max Child Relationships
Run-Time Limits
Total # of SOQL Queries Issued
Total # of records retrieved by a SOQL Query
Total # of DML Statements Issued
Total Heap Size
Maximum CPU Time Limit
Maximum Transaction Execution Time
Shared across everything in the transaction
Certified managed packages have their own set
Synchronous vs. Asynchronous
Double or More!
Source: Execution Governors and Limits
Synchronous Asynchronous
Total # of SOQL Queries 100 200
Total Heap Size 6MB 12MB
Max CPU Time 10,000 ms 60,000 ms
Max Async Apex Method
Executions
250,000 (or # of licenses x 200)
Max # of Batch jobs
queued/active concurrently
5
Max # of Records Returned
for Batch Apex query in
QueryLocator
50,000,000
Real World Scenario
Let’s break it down.
Record-Level Error
Creating an Opportunity
”NPSP”…
“TDTM_Opportunity…”
“Sounds like an issue
with NPSP… right?!
Or is it…”
Enter the Debug Log
View exactly what’s happening
Debug Logs capture database operations, system processes, and errors
• View info on both declarative and programmatic customizations
Debug Levels
Crank it up or Dial it down
● Default =
SFDC_DevConsole
● Segmented categories
Creating New Trace Flag for a User
● Setup → Debug Logs: Manually
set debug logging for User,
Automated Process, Apex Class,
or Apex Trigger
● Or if Dev Console open, will
automatically capture.
View the Debug Log
Create an Opportunity again and view the log in Setup --> Debug Logs
What’s in a Log Entry?
14:49:59.037 (37045000)|USER_DEBUG|[2]|DEBUG|Hello World!
15:51:01.071 (55856000)|DML_BEGIN|[5]|Op:Insert|Type:Invoice_Statement__c|Rows:1
Debug Log Limits
Each Debug Log = 5 MB before truncation
Retention: System = 1 day; Monitored = 7 days
Total = 250MB in a 15 minute window
Debug Log Limits
Each Debug Log = 5 MB before truncation
Retention: System = 1 day; Monitored = 7 days
Total = 250MB in a 15 minute window
Enter the Dev Console
It’s not just for code.
View Logs
Create, view, and edit code
Execute Anonymous
Set/View Checkpoints in code
Query Editor
Query Plan
(Help Menu → Preferences → Enable Query Plan = true)
Let’s get a better view in the Dev Console
If not already open, go to Debug → uncheck Show My Current Logs Only
Still not great...
So much text.
NPSP is a managed
package, so you won’t
see some information.
You will still see query
information, general
execution times, etc.
What if we just switch our perspective?
Predefined layouts of panels
Dev Console Perspectives
Default View is Log
Only
Switch to All,
Analysis, or Debug
for different views
Save and create
your own
“All” Perspective
Stack Tree
Useful for digging into long-running operations
Execution Tree: each item
Performance: aggregate
Execution Log
Useful for troubleshooting execution times and to see how many records are being returned in
each query
Clicking on Query in Stack Tree, for instance, jumps to line in Execution Log
Execution Overview
Graphical View of Executed Units
“Stairway to Heaven”
Execution Overview
Executed Units – with filtering! (Filter to Queries since this is related to Query Limits)
This query might be the issue, since the Count is 100
Execution Log
Final Limits
(default)
- your limits
NPSP’s limits
- has own limits as a
certified managed package
Execution Log
Let’s back up a few lines
It wasn’t NPSP after all.
It was custom code in
RogueOpportunityHandler’s
queryPayments() method.
Because NPSP’s Opportunity
trigger kicked it off, it surfaced the
error.
Common Errors & Strategies
for Troubleshooting
Too many query rows: 50001
Can’t query for more than 50,000 records at a time ****
Dev Console Strategy
• Execution Overview → Executed Units tab. Filter
to only show Queries. Sort by Row columns
(Descending)
NPSP Scenario:
• Legacy Rollups, Error Notifier
General Strategies
• Avoid data skew; distribute / archive
• Add LIMIT to query
• Add more filters
• If related to a batch job, lower the batch size
Too many dml rows: 10001
Can’t insert, update, upsert, delete, undelete, merge more than 10K records at once
Dev Console Strategy
• Execution Overview → Executed Units tab. Filter
to only show DML. Sort by Row columns
(Descending)
NPSP Scenario:
• Recurring Donation => Opportunity Distribution
General Strategies
• Avoid data skew; distribute / archive
• Consider batching
• If related to a batch job, lower the batch size
• NPSP: Lower your Opportunity Forecast Month
Settings or your Batch Size Settings in NPSP
Settings
Apex CPU Timeout
Your execution took too long.
Typically, there’s a lot of automation occurring.
• Lots of triggers
• Lots of packages
• Lots of process builder processes, workflow
rules, flows, validation rules
• Recursion
NPSP Scenario:
• Contact Insertion
• Closed/Won Opportunity Insertion
Strategies
• Lower batch sizes
• Consider ways to optimize code / queries through
best practices and platform options
• This is a shared limit -- so consider ALL that’s
happening for a single transaction.
Too many query locator rows: 50000001
Batch Job start() method returned more than 50 million records
NPSP Scenario
• Opportunity Naming Batch Job
• Customizable Rollups Batch Jobs **
Strategies
• Add Limits / filters if applicable
• Consider batch chunking / chaining
• Data Archival
REQUEST_RUNNING_TOO_LONG
Usually the batch job’s start() query has timed out
NPSP Scenario
• Customizable Rollups Batch Jobs **
• Seasonal Address Batch Job **
Strategies
• Make sure query is selective (use Query Plan
tool)
• Consider custom indexes, but code should be
optimized first. There are also thresholds at play.
Skinny Tables, too.
• Reduce data with filters
• Consider batch chunking/chaining
Resources
Platform Resources
Salesforce Help
• Logs Tab
• Log Inspector
• Debug Logs
• Debug Log Levels **
• Debug Log Details
• Examples of Using the Log Inspector
• Debug Log Order of Precedence
• Debug Log (Apex Developer Guide)
Trailhead
• Dev Console Basics
• Write Efficient Queries
• Build Efficient Applications without Limits Trail
• Large Data Volumes
• Strategies for Big Data Architecture
• Find and Fix Bugs with Apex Replay Debugger
NPSP Resources
General
• Github “Cumulus” Repository and Issues
• General Product Documentation
• Power of Us Hub Groups and Topics
Trailhead
• Administer NPSP Trail
• Fundraise with Nonprofit Cloud Trail
QUIZ!
In Spring ‘19, what is the maximum size
of a debug log (in megabytes)?
5 megabytes
True or False:
You can view all code from
a managed package in a debug log.
False
How do you capture the logs for
a Scheduled Apex Job that starts
running at 4 a.m.?
1. Setup → Debug Logs
2. Create Trace Flag for running user of
Scheduled Job
3. Set the Start Time to 4 a.m.
What can you do if your logs are truncated?
(A) Wait until the Summer ‘19 release to start troubleshooting
(B) Delete your previous debug logs
(C) Reduce one or more Category logging levels for your Debug Level
(D) Download the debug log and view it in VS Code
What can you do if your logs are truncated?
(A) Wait until the Summer ‘19 release to start troubleshooting
(B) Delete your previous debug logs
(C) Reduce one or more Category logging levels for your Debug Level
(D) Download the debug log and view it in VS Code
True or False:
Flows count toward SOQL Query Limits
True.
Record Update, Record Delete, Record Lookup,
and Fast Lookup count.
Bug Hunting with the Salesforce Developer Console

More Related Content

What's hot

450 tinh huống cho kế toán
450 tinh huống cho kế toán450 tinh huống cho kế toán
450 tinh huống cho kế toán
Thong Ckip
 
Microsoft dynamics warehouse management system implementation guide
Microsoft dynamics warehouse management system implementation guideMicrosoft dynamics warehouse management system implementation guide
Microsoft dynamics warehouse management system implementation guide
Prema Arjinajarn
 
De thi qlda cntt itc vdc trac nghiem 05-2006
De thi qlda cntt itc vdc trac nghiem 05-2006De thi qlda cntt itc vdc trac nghiem 05-2006
De thi qlda cntt itc vdc trac nghiem 05-2006Tran Tien
 
Bài 3: Lập trình giao diện điều khiển & Xử lý sự kiện - Lập trình winform - G...
Bài 3: Lập trình giao diện điều khiển & Xử lý sự kiện - Lập trình winform - G...Bài 3: Lập trình giao diện điều khiển & Xử lý sự kiện - Lập trình winform - G...
Bài 3: Lập trình giao diện điều khiển & Xử lý sự kiện - Lập trình winform - G...
MasterCode.vn
 
Bài tập HTML/CSS
Bài tập HTML/CSSBài tập HTML/CSS
Bài tập HTML/CSS
Thuyet Nguyen
 
Bai tap va loi giai sql
Bai tap va loi giai sqlBai tap va loi giai sql
Bai tap va loi giai sql. .
 
TỔNG HỢP TỪ VỰNG ÔN TOÁN TA LỚP 3-4-5
TỔNG HỢP TỪ VỰNG ÔN TOÁN TA LỚP 3-4-5TỔNG HỢP TỪ VỰNG ÔN TOÁN TA LỚP 3-4-5
TỔNG HỢP TỪ VỰNG ÔN TOÁN TA LỚP 3-4-5
Bồi Dưỡng HSG Toán Lớp 3
 
Bài tập toán lớp 8
Bài tập toán lớp 8Bài tập toán lớp 8
Bài tập toán lớp 8anhthuyspkt
 
Cach su dung databinding
Cach su dung databindingCach su dung databinding
Cach su dung databindingtruong le hung
 
Last Mile Delivery | Workflow management system | Zoblite
Last Mile Delivery | Workflow management system | ZobliteLast Mile Delivery | Workflow management system | Zoblite
Last Mile Delivery | Workflow management system | Zoblite
Samantha Likson
 

What's hot (11)

450 tinh huống cho kế toán
450 tinh huống cho kế toán450 tinh huống cho kế toán
450 tinh huống cho kế toán
 
Microsoft dynamics warehouse management system implementation guide
Microsoft dynamics warehouse management system implementation guideMicrosoft dynamics warehouse management system implementation guide
Microsoft dynamics warehouse management system implementation guide
 
De thi qlda cntt itc vdc trac nghiem 05-2006
De thi qlda cntt itc vdc trac nghiem 05-2006De thi qlda cntt itc vdc trac nghiem 05-2006
De thi qlda cntt itc vdc trac nghiem 05-2006
 
Bài 3: Lập trình giao diện điều khiển & Xử lý sự kiện - Lập trình winform - G...
Bài 3: Lập trình giao diện điều khiển & Xử lý sự kiện - Lập trình winform - G...Bài 3: Lập trình giao diện điều khiển & Xử lý sự kiện - Lập trình winform - G...
Bài 3: Lập trình giao diện điều khiển & Xử lý sự kiện - Lập trình winform - G...
 
Bài tập HTML/CSS
Bài tập HTML/CSSBài tập HTML/CSS
Bài tập HTML/CSS
 
Bai tap va loi giai sql
Bai tap va loi giai sqlBai tap va loi giai sql
Bai tap va loi giai sql
 
Giao trinh corel draw
Giao trinh corel drawGiao trinh corel draw
Giao trinh corel draw
 
TỔNG HỢP TỪ VỰNG ÔN TOÁN TA LỚP 3-4-5
TỔNG HỢP TỪ VỰNG ÔN TOÁN TA LỚP 3-4-5TỔNG HỢP TỪ VỰNG ÔN TOÁN TA LỚP 3-4-5
TỔNG HỢP TỪ VỰNG ÔN TOÁN TA LỚP 3-4-5
 
Bài tập toán lớp 8
Bài tập toán lớp 8Bài tập toán lớp 8
Bài tập toán lớp 8
 
Cach su dung databinding
Cach su dung databindingCach su dung databinding
Cach su dung databinding
 
Last Mile Delivery | Workflow management system | Zoblite
Last Mile Delivery | Workflow management system | ZobliteLast Mile Delivery | Workflow management system | Zoblite
Last Mile Delivery | Workflow management system | Zoblite
 

Similar to Bug Hunting with the Salesforce Developer Console

Manage Salesforce Like a Pro with Governance
Manage Salesforce Like a Pro with GovernanceManage Salesforce Like a Pro with Governance
Manage Salesforce Like a Pro with Governance
Salesforce Admins
 
Manage Development in Your Org with Salesforce Governance Framework
Manage Development in Your Org with Salesforce Governance FrameworkManage Development in Your Org with Salesforce Governance Framework
Manage Development in Your Org with Salesforce Governance Framework
Salesforce Developers
 
From Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release ManagementFrom Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release Management
Salesforce Developers
 
Development Best Practices
Development Best PracticesDevelopment Best Practices
Development Best Practices
Salesforce Partners
 
Best Practices for Team Development in a Single Org
Best Practices for Team Development in a Single OrgBest Practices for Team Development in a Single Org
Best Practices for Team Development in a Single Org
Salesforce Developers
 
Performance Testing ISV Apps to Scale
Performance Testing ISV Apps to ScalePerformance Testing ISV Apps to Scale
Performance Testing ISV Apps to Scale
Salesforce Partners
 
Performance Testing ISV Apps to Scale 11/9/2016
Performance Testing ISV Apps to Scale 11/9/2016Performance Testing ISV Apps to Scale 11/9/2016
Performance Testing ISV Apps to Scale 11/9/2016
Salesforce Partners
 
Understanding the Salesforce Architecture: How We Do the Magic We Do
Understanding the Salesforce Architecture: How We Do the Magic We DoUnderstanding the Salesforce Architecture: How We Do the Magic We Do
Understanding the Salesforce Architecture: How We Do the Magic We Do
Salesforce Developers
 
TDX19 - Untangle Your Org with Salesforce Developer Tools
TDX19 - Untangle Your Org with Salesforce Developer ToolsTDX19 - Untangle Your Org with Salesforce Developer Tools
TDX19 - Untangle Your Org with Salesforce Developer Tools
Doug Ayers
 
Decoding Triggers for Admins
Decoding Triggers for AdminsDecoding Triggers for Admins
Decoding Triggers for Admins
Salesforce Admins
 
Coding in the App Cloud
Coding in the App CloudCoding in the App Cloud
Coding in the App Cloud
Salesforce Developers
 
Managing Change With A Sensible Sandbox Architecture
Managing Change With A Sensible Sandbox ArchitectureManaging Change With A Sensible Sandbox Architecture
Managing Change With A Sensible Sandbox Architecture
Alexander Sutherland
 
Simplify your code with Salesforce DX and module development
Simplify your code with Salesforce DX and module developmentSimplify your code with Salesforce DX and module development
Simplify your code with Salesforce DX and module development
Salesforce Developers
 
The Apex Interactive Debugger
The Apex Interactive DebuggerThe Apex Interactive Debugger
The Apex Interactive Debugger
Salesforce Developers
 
Get Started with Salesforce DX!
Get Started with Salesforce DX!Get Started with Salesforce DX!
Get Started with Salesforce DX!
Salesforce Developers
 
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Salesforce Developers
 
Adopting Salesforce DX
Adopting Salesforce DXAdopting Salesforce DX
Adopting Salesforce DX
Salesforce Developers
 
Understanding Multitenancy and the Architecture of the Salesforce Platform
Understanding Multitenancy and the Architecture of the Salesforce PlatformUnderstanding Multitenancy and the Architecture of the Salesforce Platform
Understanding Multitenancy and the Architecture of the Salesforce Platform
Salesforce Developers
 
Elevate Tel Aviv
Elevate Tel AvivElevate Tel Aviv
Elevate Tel Aviv
sready
 

Similar to Bug Hunting with the Salesforce Developer Console (20)

Manage Salesforce Like a Pro with Governance
Manage Salesforce Like a Pro with GovernanceManage Salesforce Like a Pro with Governance
Manage Salesforce Like a Pro with Governance
 
Manage Development in Your Org with Salesforce Governance Framework
Manage Development in Your Org with Salesforce Governance FrameworkManage Development in Your Org with Salesforce Governance Framework
Manage Development in Your Org with Salesforce Governance Framework
 
From Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release ManagementFrom Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release Management
 
Development Best Practices
Development Best PracticesDevelopment Best Practices
Development Best Practices
 
Best Practices for Team Development in a Single Org
Best Practices for Team Development in a Single OrgBest Practices for Team Development in a Single Org
Best Practices for Team Development in a Single Org
 
Performance Testing ISV Apps to Scale
Performance Testing ISV Apps to ScalePerformance Testing ISV Apps to Scale
Performance Testing ISV Apps to Scale
 
Performance Testing ISV Apps to Scale 11/9/2016
Performance Testing ISV Apps to Scale 11/9/2016Performance Testing ISV Apps to Scale 11/9/2016
Performance Testing ISV Apps to Scale 11/9/2016
 
Understanding the Salesforce Architecture: How We Do the Magic We Do
Understanding the Salesforce Architecture: How We Do the Magic We DoUnderstanding the Salesforce Architecture: How We Do the Magic We Do
Understanding the Salesforce Architecture: How We Do the Magic We Do
 
TDX19 - Untangle Your Org with Salesforce Developer Tools
TDX19 - Untangle Your Org with Salesforce Developer ToolsTDX19 - Untangle Your Org with Salesforce Developer Tools
TDX19 - Untangle Your Org with Salesforce Developer Tools
 
Decoding Triggers for Admins
Decoding Triggers for AdminsDecoding Triggers for Admins
Decoding Triggers for Admins
 
Introduction to Apex Triggers
Introduction to Apex TriggersIntroduction to Apex Triggers
Introduction to Apex Triggers
 
Coding in the App Cloud
Coding in the App CloudCoding in the App Cloud
Coding in the App Cloud
 
Managing Change With A Sensible Sandbox Architecture
Managing Change With A Sensible Sandbox ArchitectureManaging Change With A Sensible Sandbox Architecture
Managing Change With A Sensible Sandbox Architecture
 
Simplify your code with Salesforce DX and module development
Simplify your code with Salesforce DX and module developmentSimplify your code with Salesforce DX and module development
Simplify your code with Salesforce DX and module development
 
The Apex Interactive Debugger
The Apex Interactive DebuggerThe Apex Interactive Debugger
The Apex Interactive Debugger
 
Get Started with Salesforce DX!
Get Started with Salesforce DX!Get Started with Salesforce DX!
Get Started with Salesforce DX!
 
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
 
Adopting Salesforce DX
Adopting Salesforce DXAdopting Salesforce DX
Adopting Salesforce DX
 
Understanding Multitenancy and the Architecture of the Salesforce Platform
Understanding Multitenancy and the Architecture of the Salesforce PlatformUnderstanding Multitenancy and the Architecture of the Salesforce Platform
Understanding Multitenancy and the Architecture of the Salesforce Platform
 
Elevate Tel Aviv
Elevate Tel AvivElevate Tel Aviv
Elevate Tel Aviv
 

Recently uploaded

Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 

Recently uploaded (20)

Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 

Bug Hunting with the Salesforce Developer Console

  • 1. Become a Debug Log Surgeon Taking Your Dev Console Troubleshooting Skills to the Next Level jess.lopez@salesforce.com, @jjjlo Jess Lopez, NGO Technical Architect, Salesforce.org Customer Centric Engineering Forward-Looking Statements Statement Under the Private Securities Litigation Reform Act of 1995 This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. or Salesforce.org could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with Salesforce.org or as applicable Salesforce (referred to collectively as “we” and “our”) developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our services and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to different market segments. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in its annual report on Form 10-K for the most recent fiscal year and in its quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of the Salesforce Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase salesforce.com services or the Salesforce.com-developed products and services should make the purchase decisions based upon features that are currently available. Salesforce.org assumes no obligation and does not intend to update these forward-looking statements.
  • 2. Step 1 Step 5 Step 4 Step 3 Step 2 NPSP / Managed Packages Where might we find errors? Order of Execution & Governor Limits Real World Example Common Errors and Strategies for Troubleshooting Step 6 Agenda The Dev Console Who am I? I went to college thinking I would become a surgeon.
  • 3. Who am I? I went to college thinking I would become a surgeon. Who am I? Today, I’m a Salesforce.org NGO Architect in Customer Centric Engineering.
  • 4. Who am I? It’s similar… kind of. Help! NPSP is doing this really strange thing for a customer and it’s causing them some major pain and headaches. Find and resolve the issue quickly! “ ” “Surgery” “Charts” “Grand Rounds” It’s similar… kind of. ● Capture logs and analyze with precision ● Review NPSP codebase ● Resolve issue; suggest resolution to customer; or escalate to Product team ● Case Escalations ● Investigations ● Github Issue “Novels” ● Case Studies ● Trainings/ Bootcamps “Diagnose Critical Issues” ● Run “tests” and analyze holistically. ● Determine root cause
  • 5. NPSP & Packages NPSP at a Glance NPSP = Nonprofit Success Pack Salesforce.org Product; foundation of Nonprofit Cloud Pre-built constituent and donor management components Built on Salesforce.com Flexible, open data architecture
  • 6. Maybe... Core Salesforce.com (EE or UE) Sales Cloud | Service Cloud SFDO Nonprofit Success Pack Volunteers for Salesforce Usually... Core SFDO Declarative and Programmatic Customizations Managed PackageManaged PackageManaged PackageManaged PackageManaged Package Salesforce.com (EE or UE) Sales Cloud | Service Cloud Nonprofit Success Pack Volunteers for Salesforce Marketing Cloud Communities
  • 7. Understanding Packages Unmanaged ● Editable components ● Can’t be upgraded or changed by package owner once installed ● Can see everything about the package in debug logs Managed ● Some components are editable; others are not. ● Fully upgradeable ● Push updates ● Can’t see many things about the package in debug logs Certified Managed Packages: ● On AppExchange ● Have gone through Security Review ● Get own set of limits for most per-transaction limits (DML, Query Limits, etc.) “A package is a container for something as small as an individual component or as large as a set of related apps. After creating a package, you can distribute it to other Salesforce users and organizations, including those outside your company.” Where might we find errors?
  • 8. Record-Level Errors Email / Chatter Notifications NPSP Settings → System Tools → Error Notifications ● Choose to send to specific User, System Admins, or Chatter group ● Typically related to our Scheduled Jobs
  • 9. Apex Jobs Errors Custom Object View and clear logs within NPSP Settings → System Tools → Error Logs Create reports on object, too!
  • 10. Order of Execution (Super High-Level) Validation Before Triggers Duplicate Rules Save, but don’t commit After Triggers Assignment Rules Auto-Response Rules Workflow Rules Processes / Flows Escalation Rules Entitlement Rules Roll-up Summaries (parents/grandparents) Criteria-based Sharing Rules Commit record Post-commit logic Governor Limits
  • 11. Limits, Allocations, and Limitations Allocations Edition-based constraints (e.g. # of Custom Objects, # of Validation Rules) Limits Concrete numeric values assigned to features/functionality (e.g. Max # of Sharing Rules) Limitations Expected but unavailable functionality (e.g. Importing Documents in the Data Import Wizard) Design-Time Limits Cross-Object Formulas Lots of vLookup Rules per object Picklists with lots of values Lots of Report Filters Sharing Rules Limits Criteria-Based Sharing Rules Max Child Relationships
  • 12. Run-Time Limits Total # of SOQL Queries Issued Total # of records retrieved by a SOQL Query Total # of DML Statements Issued Total Heap Size Maximum CPU Time Limit Maximum Transaction Execution Time Shared across everything in the transaction Certified managed packages have their own set Synchronous vs. Asynchronous Double or More! Source: Execution Governors and Limits Synchronous Asynchronous Total # of SOQL Queries 100 200 Total Heap Size 6MB 12MB Max CPU Time 10,000 ms 60,000 ms Max Async Apex Method Executions 250,000 (or # of licenses x 200) Max # of Batch jobs queued/active concurrently 5 Max # of Records Returned for Batch Apex query in QueryLocator 50,000,000
  • 13. Real World Scenario Let’s break it down. Record-Level Error Creating an Opportunity ”NPSP”… “TDTM_Opportunity…” “Sounds like an issue with NPSP… right?! Or is it…”
  • 14. Enter the Debug Log View exactly what’s happening Debug Logs capture database operations, system processes, and errors • View info on both declarative and programmatic customizations Debug Levels Crank it up or Dial it down ● Default = SFDC_DevConsole ● Segmented categories
  • 15. Creating New Trace Flag for a User ● Setup → Debug Logs: Manually set debug logging for User, Automated Process, Apex Class, or Apex Trigger ● Or if Dev Console open, will automatically capture. View the Debug Log Create an Opportunity again and view the log in Setup --> Debug Logs
  • 16. What’s in a Log Entry? 14:49:59.037 (37045000)|USER_DEBUG|[2]|DEBUG|Hello World! 15:51:01.071 (55856000)|DML_BEGIN|[5]|Op:Insert|Type:Invoice_Statement__c|Rows:1 Debug Log Limits Each Debug Log = 5 MB before truncation Retention: System = 1 day; Monitored = 7 days Total = 250MB in a 15 minute window
  • 17. Debug Log Limits Each Debug Log = 5 MB before truncation Retention: System = 1 day; Monitored = 7 days Total = 250MB in a 15 minute window Enter the Dev Console It’s not just for code. View Logs Create, view, and edit code Execute Anonymous Set/View Checkpoints in code Query Editor Query Plan (Help Menu → Preferences → Enable Query Plan = true)
  • 18. Let’s get a better view in the Dev Console If not already open, go to Debug → uncheck Show My Current Logs Only Still not great... So much text. NPSP is a managed package, so you won’t see some information. You will still see query information, general execution times, etc.
  • 19. What if we just switch our perspective? Predefined layouts of panels Dev Console Perspectives Default View is Log Only Switch to All, Analysis, or Debug for different views Save and create your own
  • 20. “All” Perspective Stack Tree Useful for digging into long-running operations Execution Tree: each item Performance: aggregate
  • 21. Execution Log Useful for troubleshooting execution times and to see how many records are being returned in each query Clicking on Query in Stack Tree, for instance, jumps to line in Execution Log Execution Overview Graphical View of Executed Units
  • 22. “Stairway to Heaven” Execution Overview Executed Units – with filtering! (Filter to Queries since this is related to Query Limits) This query might be the issue, since the Count is 100
  • 23. Execution Log Final Limits (default) - your limits NPSP’s limits - has own limits as a certified managed package Execution Log Let’s back up a few lines It wasn’t NPSP after all. It was custom code in RogueOpportunityHandler’s queryPayments() method. Because NPSP’s Opportunity trigger kicked it off, it surfaced the error.
  • 24. Common Errors & Strategies for Troubleshooting Too many query rows: 50001 Can’t query for more than 50,000 records at a time **** Dev Console Strategy • Execution Overview → Executed Units tab. Filter to only show Queries. Sort by Row columns (Descending) NPSP Scenario: • Legacy Rollups, Error Notifier General Strategies • Avoid data skew; distribute / archive • Add LIMIT to query • Add more filters • If related to a batch job, lower the batch size
  • 25. Too many dml rows: 10001 Can’t insert, update, upsert, delete, undelete, merge more than 10K records at once Dev Console Strategy • Execution Overview → Executed Units tab. Filter to only show DML. Sort by Row columns (Descending) NPSP Scenario: • Recurring Donation => Opportunity Distribution General Strategies • Avoid data skew; distribute / archive • Consider batching • If related to a batch job, lower the batch size • NPSP: Lower your Opportunity Forecast Month Settings or your Batch Size Settings in NPSP Settings Apex CPU Timeout Your execution took too long. Typically, there’s a lot of automation occurring. • Lots of triggers • Lots of packages • Lots of process builder processes, workflow rules, flows, validation rules • Recursion NPSP Scenario: • Contact Insertion • Closed/Won Opportunity Insertion Strategies • Lower batch sizes • Consider ways to optimize code / queries through best practices and platform options • This is a shared limit -- so consider ALL that’s happening for a single transaction.
  • 26. Too many query locator rows: 50000001 Batch Job start() method returned more than 50 million records NPSP Scenario • Opportunity Naming Batch Job • Customizable Rollups Batch Jobs ** Strategies • Add Limits / filters if applicable • Consider batch chunking / chaining • Data Archival REQUEST_RUNNING_TOO_LONG Usually the batch job’s start() query has timed out NPSP Scenario • Customizable Rollups Batch Jobs ** • Seasonal Address Batch Job ** Strategies • Make sure query is selective (use Query Plan tool) • Consider custom indexes, but code should be optimized first. There are also thresholds at play. Skinny Tables, too. • Reduce data with filters • Consider batch chunking/chaining
  • 27. Resources Platform Resources Salesforce Help • Logs Tab • Log Inspector • Debug Logs • Debug Log Levels ** • Debug Log Details • Examples of Using the Log Inspector • Debug Log Order of Precedence • Debug Log (Apex Developer Guide) Trailhead • Dev Console Basics • Write Efficient Queries • Build Efficient Applications without Limits Trail • Large Data Volumes • Strategies for Big Data Architecture • Find and Fix Bugs with Apex Replay Debugger
  • 28. NPSP Resources General • Github “Cumulus” Repository and Issues • General Product Documentation • Power of Us Hub Groups and Topics Trailhead • Administer NPSP Trail • Fundraise with Nonprofit Cloud Trail QUIZ!
  • 29. In Spring ‘19, what is the maximum size of a debug log (in megabytes)? 5 megabytes
  • 30. True or False: You can view all code from a managed package in a debug log. False
  • 31. How do you capture the logs for a Scheduled Apex Job that starts running at 4 a.m.? 1. Setup → Debug Logs 2. Create Trace Flag for running user of Scheduled Job 3. Set the Start Time to 4 a.m.
  • 32. What can you do if your logs are truncated? (A) Wait until the Summer ‘19 release to start troubleshooting (B) Delete your previous debug logs (C) Reduce one or more Category logging levels for your Debug Level (D) Download the debug log and view it in VS Code What can you do if your logs are truncated? (A) Wait until the Summer ‘19 release to start troubleshooting (B) Delete your previous debug logs (C) Reduce one or more Category logging levels for your Debug Level (D) Download the debug log and view it in VS Code
  • 33. True or False: Flows count toward SOQL Query Limits True. Record Update, Record Delete, Record Lookup, and Fast Lookup count.