The Limits You Don’t Know, Can Hurt Your Project : Amit Chaudhary

The Limits You Don’t Know, Can Hurt Your Project
by: Amit Chaudhary
blow post content copied from  Apex Hours
click here to view original post

While the number of API calls and storage limits get all the attention when planning a large-scale Salesforce implementation, less well-known limits can completely derail your project. With a CTA as your guide, examine the solution design and the performance impacts that only became apparent after rollout. Dive into the details of possible work arounds and the limitations encountered during each attempted corrective action.

See if you can guess the limits the caused the pain (hint: it involves Email Messages and Files) and help architect a resolution. This session is for aspiring architects and developers who face enterprise scale challenges. This session will help you in Identify design decisions that avoid governor limits when working with large data volumes and files

Our Scenario – Transportation Company (TC)

Global company wants to modernize support organization. Focused on business accounts and 10k service users across AMER, EMEA, APAC. Extensive experience with custom development, new to Salesforce.

Business Requirements

  • Current processes managed through, which customer prefer
  • Lack comprehensive customer view for hand-offs across world
  • Need to adhere to local regulations and requirements
  • Recent security breach in existing systems, need to quickly move to another solution

What project methodology do you recommend ? Agile

  1. Delivering quickly to retire systems is key
  2. You’ll focus on minimum viable project functionality for initial groups
  3. You will align to standard, out of the box functionality
  4. Your project has passed its first hurdle

Limit Calculation

  • As an experienced architect, you start by estimating limits
  • 2 million Accounts
  • 4 million Contacts
  • 50k cases/month for initial groups
  • 5 shipments per customer per year
  • Integration to logistics systems that supports REST

B. What should we calculate? 1.Data & File Storage 2.API Consumption

Data & File Storage

  • Accounts & Contacts = (2 M + 4 M) * 2 KB = 12 GB
  • Cases = 50 K * 36  = 1.8 M * 2 KB = 4 GB
  • Email Assumption = 1.8 M * 3 per case * 2 KB = 11 GB
  • Shipments = 2 M * 5 * 3 * 2 KB = 60 GB
  • Total 87 GB over 3 years
  • Initial Group
    • 10 GB + (1,000 * 20 MB) = 30 GB
    • 10 GB + (1,000 * 2 GB) = 2 TB file
  • Full org
    • 10 GB + (10,000 * 20 MB) = 210 GB
    • 10 GB + (10,000 * 2 GB) = 20 TB file
  • File Assumptions
    • 100 KB/file = 200 M
    • 200 KB/File = 100 M
  • Go to API Calculation

API Calculation

  • Cases per day
    • 50 K per month / 20 work days = 2.5 K per day
    • 10 calls to logistics for related information
    • 2.5 K * 10 = 25 K calls
  • Shipments,
    • 4 calls per shipment
    • 2 M * 5 /365 = 28 k * 4 = 112 K calls
  • Total 140 K per day
  • Initial Group
    • 1,000 * 1,000 = 1M / 24 Hours
  • Full org
    • 10,000 * 1,000 = 10M / 24 Hours
  • If needed, Go to Data & File Storage

Email Functionality

  • Given the importance of email, let’s dive deeper into solving this requirement
  • Customers need to email CT with issues, questions or requests
  • CT Support will process the case and follow-up
  • Internal CT employees may forward items for support 

How should email functionality be delivered? 1.Custom Email Handler 2.Email to Case

Custom Email Handler

The custom email handler works fine during development, problems start at go live. Timeouts and locking frequently occur. CT is new to Salesforce with little knowledge of LDV and bulkification. The backlog of cases grows & customers are not supported.

Email to Case

  • CT repurposes its existing email address to automatically create cases in Salesforce
  • Support agents can easily reply from within Salesforce and leverage templates
  • Combined with other standard functionality, such as service console, the MVP is quickly delivered
  • Support teams are happy with the new functionality
  • The unsecure systems were retired on schedule
  • Plans are made to quickly expand to the full support organization.
  • Your project is a success!

Email Related Limits

  • On-Demand Email to case supports 1,000 per user license, up to 1M
  • No limit on outbound email sent from the Case to a Contact
  • Keep looking, but make it fast.

Data/File Storage or API

  • Overall storage is only 60% used
    • Email Message is the top object
    • Case is next
  • File storage is only 35% used
    • Content Bodies reports 30 M objects
  • API limits
    • Ranges between 10-15% used per 24 hours
  • Let’s take a look at Salesforce CRM Content Limits.
  • Content: maximum number of files
    • 30 Million
  • You take a quick look at data storage and Content Bodies are 30,000,017

Configure/Build An Archive Solution

  • No native options in Salesforce to archive
  • Customer 360 Privacy Center
    • Didn’t exist at the time
    • Aimed at data retention tied with privacy regulation
  • Build your own solution – big objects, big questions?
    • How handle schema changes
    • How handle binary content/view
    • How do you restore
  • None of these options get you going at 88 mph to quickly get out of the situation

Content Object Model

How should you query the related files? 1.Content Document/Version 2.Hmm, something is missing.

Content Document

  • Content Document holds the header information about a File
  • Content Version has the binary information, as well as multiple revisions (if needed)
  • Neither of these relate back to the Case or Email Message
  • See if you can find the missing link

The missing Content Document Link

  • Link between file in Salesforce and where it is shared
  • ContentDocumentId
    • LinkedEntityId
    • ShareType
    • Visiblity
  • So let’s look at the object
    • Hmm, there’s an error with a basic SELECT

Try below query

SELECT Id, LinkedEntityId, ContentDocumentId, ShareType, Visibility FROM ContentDocumentLink 

Then you will get below error

Implementation Restriction: ContentDocumentLink requires a filter by a single Id on ContentDocumentId or LinkedEntityId using the equals operator or multiple Id’s using the In operator.


Check out the our YouTube, and don’t forget to subscribe to our channel, so that you’re notified right away when a new video is available.

The post The Limits You Don’t Know, Can Hurt Your Project appeared first on Apex Hours.

July 26, 2021 at 06:28PM
Click here for more details...

The original post is available in Apex Hours by Amit Chaudhary
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.