How to delete the Apex components with Tooling API
Brahmanaidu salesforce blog
by
6M ago
/* Author: Brahmanaidu Mandalapu Created date: 02/10/2023 Description: This class is used to delete the apex components based on the user input */ public class ToolingAPIController { private static final String STR_QUERY ='StrQuery'; private static final String METHOD_NAME_KEY ='methodName'; public static Map<String, Object> performCallout(Map<String, Object> inputMap){ Map<String, Object> outputMap = new Map<String, Object>(); String query = (String) inputMap.get(STR_QUERY); String methodName = (St ..read more
Visit website
How to get the selected record details in Lightning Webcomponents
Brahmanaidu salesforce blog
by
3y ago
public class AccountController {@AuraEnabled(cacheable=true)public static List<Account> displayAccounts(){return [select Id,Name,Site from Account LIMIT 2];}}<template><table class="slds-table slds-table_cell-buffer slds-table_bordered"><tr><td><b>Name</b></td><td><b>Site</b></td><td><b>Action</b></td></tr><template for:each={accounts} for:item="acc" for:index="index"><tr key={acc.Id}><td>{acc.Name}</td><td>{acc.Site}</td><td><lightning-butto ..read more
Visit website
How to display the error messages in Lightning webcomponents
Brahmanaidu salesforce blog
by
3y ago
registrationForm.html=====================<template><lightning-input label="FirstName"></lightning-input><lightning-input label="LastName"></lightning-input><lightning-button label="Submit" variant="brand" onclick={handleValidate}></lightning-button></template>registrationForm.js===================import { LightningElement,track } from 'lwc';export default class RegistrationForm extends LightningElement {@track errors={"FirstName":"Please Enter the FirstName","LastName":"Please Enter the LastName"}; handleValidate(){this.template.qu ..read more
Visit website
How to use regular expressions in Lightning Webcomponents
Brahmanaidu salesforce blog
by
3y ago
panCardValidation.html======================<template><lightning-input label="Enter the pancard number" class="panCard"></lightning-input><lightning-button label="Submit" onclick={handleValidate}></lightning-button></template>panCardValidation.js====================import { LightningElement } from 'lwc';export default class PanCardValidtion extends LightningElement { handleValidate(){ const panCardRegex="[A-Z]{5}[0-9]{4}[A-Z]{1}"; let panCard=this.template.querySelector(".panCard"); let panCardVal=panCard.value;if(panCardVal.match ..read more
Visit website
How to disable the input fields in Lightning Webcomponents with test class
Brahmanaidu salesforce blog
by
3y ago
sampleForm.html=====================<template><lightning-input type="text" label="FirstName" class="fname"></lightning-input><lightning-input type="text" label="LastName" class="lname"></lightning-input><lightning-button label="Disable" variant="brand" onclick={handleClick}></lightning-button></template>sampleForm.js====================import { LightningElement,track } from 'lwc';export default class SampleForm extends LightningElement { handleClick(){this.template.querySelectorAll('lightning-input').forEach(item=>{ item.disabled=true;})}}sa ..read more
Visit website
How to change the button style in lwc
Brahmanaidu salesforce blog
by
3y ago
sampleDemo.html<template><lightning-button label="submit" variant="brand" onclick={handleClick}></lightning-button></template>sampleDemo.jsimport { LightningElement } from 'lwc';export default class SampleDemo extends LightningElement { handleClick(){this.template.querySelector('lightning-button').variant='Destructive';}}sampleDemo.test.jsimport {createElement} from 'lwc';import SampleDemo from 'c/sampleDemo';describe('c-demo-test',()=>{ beforeEach(()=>{ const element=createElement('c-sample-demo',{is:SampleDemo}) document.body.appendChild(element);})test('chang ..read more
Visit website
How to test the html content in Lightning Webcomponents
Brahmanaidu salesforce blog
by
3y ago
sampleDemo.html<template><p class="FirstName">Brahmanaidu</p><p class="LastName">Mandalapu</p></template>sampleDemo.test.jsimport {createElement} from 'lwc';import SampleDemo from 'c/sampleDemo';describe('c-sample-Demo',()=>{ test('display FirstName',()=>{const element=createElement('c-sample-Demo',{is:SampleDemo}); document.body.appendChild(element);const fName=element.shadowRoot.querySelector('p.FirstName'); expect(fName.textContent).toBe('Brahmanaidu');}) test('display LastName',()=>{const element=createElement('c-sample-Demo',{is:SampleDemo ..read more
Visit website
Simple test class in Lightning Webcomponents
Brahmanaidu salesforce blog
by
3y ago
sampleDemo.html<template><p>Brahmanaidu</p><h1>Mandalapu</h1><b>Welcome to sfdcscenarios</b></template>sampleDemo.test.jsimport {createElement} from 'lwc';import SampleDemo from 'c/sampleDemo';describe('c-sample-demo',()=>{ beforeEach(()=>{const element=createElement('c-sample-demo',{is:SampleDemo}); document.body.appendChild(element)}) test('testing paragraph',()=>{const element=document.querySelector('c-sample-demo');const pTxt=element.shadowRoot.querySelector('p'); expect(pTxt.textContent).toBe('Brahmanaidu');}) test('testing header ..read more
Visit website
Button Functionality with test class in Lightning Web components
Brahmanaidu salesforce blog
by
3y ago
buttonFunctionality.html<template><lightning-button label="submit" onclick={handleClick}></lightning-button><template if:true={isActive}><div class="ifBlock"> Yes I am in if block</div></template><template if:false={isActive}><div class="elseBlock"> Yes I am in else block</div></template></template>buttonFunctionality.jsimport { LightningElement,track } from 'lwc';export default class ButtonFunctionality extends LightningElement {@track isActive=false; handleClick(){this.isActive=true;} }buttonFunctionality.test.jsimport ..read more
Visit website
Dynamic search functionality in Lightning Web Component with event
Brahmanaidu salesforce blog
by
3y ago
public with sharing class AccountDataController {public AccountDataController() {}@AuraEnabledpublic static List<Account> displayAccounts(String searchekey){ String searchword='%'+searchekey+'%'; List<Account> returnlist=new List<Account>();if(!String.isBlank(searchekey))for(Account acc:[select Id,Name,Site from Account where Name like:searchword]){ returnlist.add(acc);}return returnlist;}}searchAccountComponent.html<template><lightning-input type="text" class="accName" label="SearchAccounts" onchange={handleSearch}></lightning-input></t ..read more
Visit website

Follow Brahmanaidu salesforce blog on FeedSpot

Continue with Google
Continue with Apple
OR