This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Scenario | Recommended approach | |
|---|---|---|
| Fetch fields for a known record ID | getRecord (UI API) | |
| Display a standard related list | getRelatedListRecords (UI API) | |
| Fetch multiple related lists from one parent | getRelatedListRecordsBatch (UI API) | |
| Filter records by criteria (no known ID) | GraphQL wire adapter | |
| Join data across multiple objects in one request | GraphQL wire adapter | |
| Aggregations (COUNT / SUM / etc.) | GraphQL wire adapter | |
| Cursor-based pagination for large lists | GraphQL wire adapter | |
| Simple create / update / delete (no business logic) | executeMutation (GraphQL) or uiRecordApi | |
| DML with validation or triggers you need to control | Apex |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Adapter | Best for | |
|---|---|---|
| getRecord | Fetching fields for a known record ID | |
| getRecords | Fetching fields for multiple known record IDs | |
| getRelatedListRecords | Displaying a standard related list | |
| getRelatedListRecordsBatch | Multiple related lists from one parent in one call | |
| getListInfoByName | Metadata for a list view | |
| getObjectInfo | Object schema and field metadata |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8" ?> | |
| <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> | |
| <apiVersion>66.0</apiVersion> | |
| <isExposed>true</isExposed> | |
| <masterLabel>QR Code Generator</masterLabel> | |
| <description>Generate QR Codes with optional logo overlay.</description> | |
| <targets> | |
| <target>lightning__AppPage</target> | |
| <target>lightning__HomePage</target> | |
| <target>lightning__FlowScreen</target> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .spinner-container { | |
| display: flex; | |
| justify-content: center; | |
| padding: 2rem 0; | |
| } | |
| .logo-preview { | |
| display: inline-flex; | |
| align-items: flex-start; | |
| gap: 0.25rem; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import qrcodejs from '@salesforce/resourceUrl/qrcodejs'; | |
| import { loadScript } from 'lightning/platformResourceLoader'; | |
| import { LightningElement } from 'lwc'; | |
| export default class QrCodeGenerator extends LightningElement { | |
| url = ''; | |
| logoDataUrl = null; | |
| logoFileName = ''; | |
| qrCodeDataUrl = ''; | |
| isLoading = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <lightning-card title="QR Code Generator" icon-name="utility:scan"> | |
| <div class="slds-var-p-horizontal_medium slds-var-p-bottom_medium"> | |
| <lightning-input | |
| type="url" | |
| label="Target URL" | |
| placeholder="https://example.com" | |
| value={url} | |
| onchange={handleUrlChange} | |
| class="slds-var-m-bottom_small" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default class TakeUserProfilePicture extends LightningElement { | |
| video; | |
| canvas; | |
| renderedCallback() { | |
| this.video = this.template.querySelector('.video'); | |
| this.canvas = this.template.querySelector('.canvas'); | |
| } | |
| async startCamera() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <lightning-card icon-name="custom:custom38" title="Take User Profile Picture"> | |
| <div class="slds-grid slds-gutters"> | |
| <div class="slds-col slds-size_1-of-2"> | |
| <video class="slds-p-left_small video" autoplay></video> | |
| <canvas class="slds-hide canvas"></canvas> | |
| </div> | |
| <div class="slds-col slds-size_1-of-2"> | |
| <img src="" class="slds-p-right_small slds-hide preview" alt="Captured User Photo" /> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public with sharing class UserProfilePictureController { | |
| @AuraEnabled | |
| public static void updateProfilePicture(String base64) { | |
| try { | |
| Blob b = EncodingUtil.base64Decode(base64); | |
| ConnectApi.BinaryInput binaryInput = new ConnectApi.BinaryInput(b, 'image/png', 'UserPhoto.png'); | |
| ConnectApi.UserProfiles.setPhoto(null, 'me', binaryInput); | |
| } catch (Exception e) { | |
| System.debug('The following exception has occurred: ' + e.getMessage()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default class ContentDocumentTable extends NavigationMixin(LightningElement) { | |
| @api recordId = null; | |
| @api library = 'Documents'; | |
| @api folder = null; | |
| @api showCard = false; | |
| @api cardIcon = 'standard:file'; | |
| @api cardTitle = 'Document Table'; | |
| @api showDownloadAction = false; | |
| @api showViewAction = false; | |
| @api showDeleteAction = false; |
NewerOlder