Salesforce LWC for searching thru records by setting sObject and fields as attributes via parent component or the App or Community builders π
Screenie of rummage-view containing rummage-bar and reactive-table
This uses SOQL's LIKE operator to preform searches via the accompanying Rummage Apex class
In SOQL, the LIKE operator supports string fields only which is stated in the docs here
String data types include Text, Phone, Picklist, URL, etc.
If you need to search other data types, creating a text based formula field may help
Formula Example 1: TEXT( Expiration_Date__c )
Formula Example 2: Primary_Contact__r.FirstName +' '+ Primary_Contact__r.LastName
Covert with SFDX; This creates a folder called deploy
sfdx force:source:convert -r force-app -d deploy
Now you can deploy from the resulting deploy
directory
π Below deploys to the default org set; Add -u [email protected]
or -u alias
to deploy else where
sfdx force:mdapi:deploy -d deploy -w -1 -l RunSpecifiedTests -r RummageTest --verbose
Results should more or less mirror below
Deployment finished in 121000ms
=== Result
Status: Succeeded
jobid: 0Af3b000003ZSudCAG
Completed: 2019-05-17T14:39:25.000Z
Component errors: 0
Components deployed: 5
Components total: 5
Tests errors: 0
Tests completed: 1
Tests total: 1
Check only: false
=== Test Success [1]
NAME METHOD
βββββββββββ ββββββ
RummageTest search
=== Apex Code Coverage
NAME % COVERED UNCOVERED LINES
βββββββ βββββββββ βββββββββββββββ
Rummage 92% 19
Total Test Time: 158.0
=== Components Deployed [5]
TYPE FILE NAME ID
ββββββββββββββββββββββββ ββββββββββββββββββββββββββββββ βββββββββββββ ββββββββββββββββββ
deploy/package.xml package.xml
ApexClass deploy/classes/Rummage.cls Rummage 01p3b000000JeCWAA0
ApexClass deploy/classes/RummageTest.cls RummageTest 01p3b000000JeCXAA0
LightningComponentBundle deploy/lwc/reactiveTable reactiveTable 0Rb3b0000004C9NCAU
LightningComponentBundle deploy/lwc/rummageBar rummageBar 0Rb3b0000004C9OCAU
LightningComponentBundle deploy/lwc/rummageView rummageView 0Rb3b0000004C9PCAU
Coded with π by Jamie Smith