You will learn why global DOM queries, ID selectors, setTimeout-based timing and early lifecycle access break LWC components, and the reliable alternatives for each.
Why read this
The piece closes a series, so the reader gets a complete set of runtime fixes.
Fragile timing workaround
setTimeout to wait for data
setTimeout(..., 0) after a property change
Guessed wall-clock delay
Reliable alternative
async and await for loaded data
renderedCallback after each render
Signal from the engine
Replacing timing workarounds with lifecycle-aware code makes updates reliable
This final post in a series on Lightning Web Component anti-patterns covers runtime mistakes in DOM access, asynchronous timing, the component lifecycle, performance, and base component usage. The article’s central point is that these bugs stem from wrong assumptions about when things happen, such as when the DOM exists, when a render has completed, and which runtime a component runs in.
On DOM access, the article warns against querying the global document, since Lightning Web Security scopes calls to the sandbox and tests may behave differently from production; it recommends scoping queries to the component’s template or using LWC:ref. It also warns against setting innerHTML, which carries XSS risk and conflicts with reactive rendering, recommending declarative markup and lightning-formatted-rich-text for trusted rich text. ID selectors are unreliable because LWC rewrites id attributes at render time, so class selectors, data attributes, or LWC:ref should be used instead. For timing, setTimeout should not be used to wait for async data (use async/await) or for re-renders (use renderedCallback, which runs after every render). For lifecycle, @api values are not readable in the constructor, DOM access fails in the constructor and connectedCallback because nothing has rendered yet, and this.template.children should be avoided in favour of stable selectors.
Performance guidance says that repeatedly crossing the Lightning Web Security proxy boundary becomes costly with large data: clone host data into local arrays once, push aggregation into Apex, and prefer plain objects and arrays over Set and Map for large collections. The base component section covers several silent failures: platformShowToastEvent does nothing outside Lightning Experience and mobile, so lightning/toast should be used; only lightning/modal and lightning/datatable support extension, so other components should be wrapped; the record ID should be read from the success event rather than from submit; internal SLDS shadow styles should not be overridden, and the public –slds- hooks used instead; and mobile support must be checked, since lightning-datatable fails silently in the Salesforce Mobile App and desktop responsive mode does not reliably reproduce this.
The conclusion ties the patterns together: LWC guarantees are narrower than they seem, and assuming readiness before it exists causes most of these problems. The article closes with a list of resources, including lifecycle documentation, LWC:ref, lightning/toast, @Salesforce/client/formFactor, and the LWC ESLint plugin rules.
You will learn how Salesforce assesses knowledge content before indexing, how it tests Data 360 retrieval changes against a golden data set, and why a human-reviewed failure rate matters more than raw metrics.
Hypothesize how the change affects answers
Build the recipe in Data 360
Evaluate with quantitative and qualitative tests
Reject or deploy, then keep monitoring
The loop used to test each change to the agent's Data 360 configuration
The Salesforce Help Agent is grounded in Salesforce’s own product knowledge, prepared and organized in Data 360 and used by Agentforce through retrieval augmented generation. The authors argue that an agent’s answers can be no better than the content it retrieves, so content quality has to be checked before any model or configuration work starts.
The first lesson is a Fit, Gap, Clash review of every article: whether it answers a real question, whether it leaves a customer issue uncovered, and whether it contradicts other content. Articles are scored using health, failure, resolution and traffic signals, paired with top case drivers. More content does not mean better coverage, and the team chose a separate agent for the Informatica help portal rather than adding that content to the existing Help Agent, which now resolves 92% of questions on that site without a case being filed. Content authors and an AI and Data team share the work, with Agent Managers connecting them.
The second and third lessons describe building by hypothesis: each change to a Data 360 recipe is tested, and only changes that improve answers ship. A product-name metadata hypothesis showed flat results and was rejected, leading to a new recipe that pairs metadata with prompt instructions. Evaluation uses a golden data set of about 200 utterances, each validated by a person, with acceptance criteria covering correct, complete and relevant answers.
The final lesson combines deterministic retrieval metrics, semantic quality checks and business outcomes with human and LLM review. When section-aware chunking was tested against fixed-size chunking on 195 query-document pairs, metrics flagged 8 failures, but review showed the real failure rate was closer to 1%, and that figure was used to approve production.
You will learn how Salesforce built lead scoring and three-way routing on a unified Data 360 profile, and which design choices carried the gains.
Why read this
The piece also gives a practical checklist for applying the pattern at a smaller scale.
Match to unified profile
Classify job level and score
Apply team thresholds
Route to sales, nurture or agent
Each inbound response is matched, scored and sent to one of three routes
Salesforce’s sales team routed leads across three systems with heavily customized rules, and routing changes often went live weeks late. The team unified signals such as website activity, event attendance, email engagement, support history and product usage in Data 360, then built scoring and routing on that profile. Its in-house data science team built a lead score from 1 to 5 and a product interest score, and each inbound response is matched to a profile, classified by job level, scored, and sent to a sales team, marketing nurture or agent-first outreach.
The article reports that lead assignment fell from 20 minutes to 20 seconds, custom code dropped 90% from about 2 million lines, and routing changes now take days instead of four weeks. Thresholds sit in configurable tables rather than code, so a business user could raise the bar for Tableau leads without a release. The authors credit the whole implementation for these results, not Data 360 alone, and note that the same profile drives an email journey with a 233% higher click-through rate than their average Marketing Cloud journey.
The closing advice is to unify data before scoring, define what sales-ready means for each team, give every lead a destination, and keep rule changes out of code releases.
You will learn how bulk record processing, database operations inside loops, repeated writes, hard-coded IDs and weak fault handling make Flow fail under load, and how to design around each one.
Why read this
The piece is practical guidance for anyone whose orgs run record-triggered automation at volume.
This Salesforce Ben article, written for architects, lists ten Flow design mistakes that cause failures as orgs grow, and suggests a fix for each. The first concerns treating Flow as a single-record tool: bulk operations from Data Loader or List Views share one transaction’s governor limits, so authors should use before-save flows for same-record updates, tighten entry conditions, and make invocable Apex bulk-safe. The second warns against database operations inside loops, recommending retrieving records before the loop, changing values in memory, and saving a collection once afterwards, with Collection Filters and Transform as alternatives. The third covers writing to the database too often, since each write can fire further automation and cause record-locking, so decisions should come first and writes should be batched near the end.
The next several points cover maintainability, testing and error handling. Hard-coded IDs break when flows move between environments, so the article recommends looking up records by DeveloperName, using Custom Metadata, Custom Labels or Custom Settings. Flows without deliberate fault handling leave failures to Salesforce’s default response, so authors should choose between blocking saves, guiding users, or logging failures, and should understand how rollback differs for unhandled errors, handled faults and explicit rollbacks. Testing with a single record gives little assurance, so the article urges bulk tests of at least 200 records, representative data, and separate logic, transaction-limit and load testing.
The final points address structure and design. Monolithic flows are hard to maintain, so the piece suggests subflows for repeated logic, self-contained processes and frequently changing rules, while warning against too many tiny subflows and recommending grouping flows by business purpose. Transaction boundaries matter because governor limits apply per transaction, and asynchronous paths, scheduled paths, screens, Wait elements and Platform Events can move work out of the original save, with the trade-off that committed changes cannot be rolled back. Screen Flows need care when users click Previous, which can cause duplicates, so the article advises saving at the end and making steps idempotent. Finally, it cautions that data model problems such as data skew, non-selective queries, recreated roll-up functionality and master-detail choices can limit what Flow design alone can fix. The conclusion advises reviewing the highest-volume objects first.
You will see how profiles, field-level security and Permission Sets divide access control, and what Shield adds for regulated data. It is a refresher aimed at admins rather than new material.