April 2020

Salesforce

lightning-accordion – Expand and Collapsible sections in LWC

Sample Code: HTML: <template>     <div class="slds-box slds-theme_default">         <lightning-accordion class="example-accordion"                             onsectiontoggle={handleToggleSection}                             allow-multiple-sections-open>             <lightning-accordion-section name="A" label="Accordion Title A">                 Test             </lightning-accordion-section>         </lightning-accordion>      </div>    </template> ....

Salesforce

JSON deserializeUntyped using Apex in Salesforce

Sample Code: String strJSON = '{"items":[{"Date Field":"01-01-1999","Prototype Settings":"PS3","Hardware Type":"Type1","Overall Status":"In Progress","Source":"Web"},{"Date Field":"18-05-1999","Prototype Settings":"PS6","Hardware Type":"Type3","Overall Status":"Completed","Source":"Email"}]}'; Map < String, Object > fullMap = ( Map < String, Object > )JSON.deserializeUntyped( strJSON ....

Salesforce

Reusable Related List using LWC in Salesforce

Sample code: HTML: <template> <lightning-card title={titleWithCount} icon-name="standard:record"> <lightning-button label="New" slot="actions" onclick={createNew}></lightning-button> <div slot="footer"> <div if:true={countBool}> <lightning-button label="View All" onclick={navigateToRelatedList}></lightning-button> </div> </div> <div class="slds-m-around_medium"> <div if:true={listRecords}> <template for:each={listRecords} for:item="rec"> <div key={rec.Id} ....