# Identifiers, Regions, and Container Facets ## Generating Unique Identifiers **Before generating ANY new identifier or facet name, read the existing XML and extract all `` and `` values first.** **Identifier Generation Algorithm**: ```text 1. Extract ALL existing AND values from XML 2. Generate base name: {namespace}_{componentType}_{context} Examples: "lst_relatedList_contacts", "flexipage_richText_header" 3. Find first available number: - Try "{base}_1" - If exists, try "{base}_2", "{base}_3", etc. - Use first available ``` **Examples**: - First related list: `lst_relatedList_contacts` - Second related list: `lst_relatedList_contacts_2` - First rich text: `flexipage_richText_header` - Second rich text: `flexipage_richText_header_2` - Field section: `flexipage_fieldSection` **Facet Naming - Two Patterns**: 1. **Named facets** (for major content areas): - `detailTabContent` (detail tab content) - `maintabs` (main tab container) - `sidebartabs` (sidebar tab container) - Use when facet represents meaningful content area 2. **UUID facets** (for internal structure): - Format: `Facet-{8hex}-{4hex}-{4hex}-{4hex}-{12hex}` - Example: `Facet-66d5a4b3-bf14-4665-ba75-1ceaa71b2cde` - Use for field section columns, nested containers, anonymous slots **When adding components to existing files:** - Check if target facet name already exists - If exists: Add new `` to that existing region (see xml_rules.md section 5 for details) - If doesn't exist: Create new region with unique name --- ## Region Selection **Parse regions from file** - don't hardcode names. Templates vary: - `flexipage:recordHomeTemplateDesktop` → `header`, `main`, `sidebar` - `runtime_service_fieldservice:...` → `header`, `main`, `footer` - Others may have different region names **Default placement**: End of target region (after last ``) **Insertion pattern**: ```xml main Region ``` --- ## Container Components with Facets Components like tabs, accordions, and field sections require a **3-layer facet pattern**. There is NO single "tabs" component — you must use `flexipage:tabset` + `flexipage:tab` + content facets. **The 3-layer tab pattern:** ```xml force:detailPanel force_detailPanel1 detailTabContent Facet relatedListComponentOverride NONE force:relatedListContainer force_relatedListContainer1 relatedTabContent Facet active true body detailTabContent title Standard.Tab.detail flexipage:tab flexipage_tab1 active false body relatedTabContent title Standard.Tab.relatedLists flexipage:tab flexipage_tab2 maintabs Facet tabs maintabs flexipage:tabset flexipage_tabset1 main Region ``` **Critical rules:** - Facet regions are **siblings** of template regions (same level), NEVER nested inside them - Each `flexipage:tab` has `body` pointing to a content facet name, `title` for the label, and `active` (true/false) - The `flexipage:tabset` has a single `tabs` property pointing to the tabs facet name - Standard tab titles: `Standard.Tab.detail`, `Standard.Tab.relatedLists`, `Standard.Tab.activity`, `Standard.Tab.news` - The component is `flexipage:tabset` — NOT `flexipage:tabs`, `flexipage:tabset2`, or `lightning:tabset`