Regex Matcher In Apex
Biswajeet Samal - The Programmer
by Biswajeet
1y ago
The blow code is replacing the SSN number with * from a sentence. Sample Code: String searchText = 'This is your SSN 000-45-6789 number'; Pattern objPattern = Pattern.compile('[0-9]{3}-[0-9]{2}-[0-9]{4}'); String result = objPattern.matcher(searchText).replaceAll('***-**-****'); System.debug('searchText-' + searchText); System.debug('result-' + result ..read more
Visit website
LWC Navigate Record Detail Page To New Browser Tab
Biswajeet Samal - The Programmer
by Biswajeet
1y ago
import { LightningElement, track } from 'lwc'; import { NavigationMixin } from 'lightning/navigation'; export default class TestComponent extends NavigationMixin(LightningElement) { @track accountId = '0018G00000KsFcJQAV'; handlenavigateToAccountViewPage(event) { this[NavigationMixin.GenerateUrl]({ type: 'standard__recordPage', attributes: { recordId: this.accountId, objectApiName: 'Account', actionName: 'view' } }).then(generatedUrl => { window.open(generatedUrl ..read more
Visit website
Get Weekly Days Business Hours Difference
Biswajeet Samal - The Programmer
by Biswajeet
1y ago
BusinessHours bh = [SELECT Id, Name, IsActive, IsDefault, SundayStartTime, SundayEndTime, MondayStartTime, MondayEndTime, TuesdayStartTime, TuesdayEndTime, WednesdayStartTime, WednesdayEndTime, ThursdayStartTime, ThursdayEndTime, FridayStartTime, FridayEndTime, SaturdayStartTime, SaturdayEndTime, TimeZoneSidKey FROM BusinessHours WHERE IsDefault = true]; DateTime startTime; DateTime endTime; Datetime dt = System.now(); String dayOfWeek = dt.format('EEEE'); if(dayOfWeek.equalsIgnoreCase('Saunday')){ startTi ..read more
Visit website
Lightning Web Component(LWC) Toast Messages
Biswajeet Samal - The Programmer
by Biswajeet
3y ago
A component can send a toast notification that pops up to alert users of a success, error, or warning. A toast can also simply provide information. To display a toast notification in Lightning Experience or Lightning communities, import ShowToastEvent from the lightning/platformShowToastEvent module. Here is the example to show Lightning Web Component(LWC) Toast Messages. Toast Event Properties: Parameter Type Description title String (Required) The title of the toast, displayed as a heading. message String (Required) A string representing the body of the message. It can contain place ..read more
Visit website
Salesforce LWC Custom Datatable Pagination
Biswajeet Samal - The Programmer
by Biswajeet
3y ago
Apex Class: public class AccountController { @AuraEnabled//Get Account Records public static String getAccountList(Integer pageSize, Integer pageNumber){ String jsonDT = ''; //Offset for SOQL Integer offset = (pageNumber - 1) * pageSize; //Total Records Integer totalRecords = [SELECT COUNT() FROM Account]; Integer recordEnd = pageSize * pageNumber; AccountDTWrapper objDT = new AccountDTWrapper(); objDT.pageSize = pageSize; objDT.pageNumber = pageNumber; objDT.recordStart ..read more
Visit website
Salesforce Lightning Custom Datatable Pagination & Sorting
Biswajeet Samal - The Programmer
by Biswajeet
3y ago
Apex Class: public class AccountController { @AuraEnabled//Get Account Records public static String getAccountList(Integer pageSize, Integer pageNumber, String sortingField, Boolean isSortAsc){ String jsonDT = ''; //Offset for SOQL Integer offset = (pageNumber - 1) * pageSize; //Total Records Integer totalRecords = [SELECT COUNT() FROM Account]; Integer recordEnd = pageSize * pageNumber; String sortBy = isSortAsc ? 'ASC' : 'DESC'; String query = 'SELECT Id, Name, AccountNumber, Ind ..read more
Visit website
Hyperlink to recordId in Lightning Aura Component
Biswajeet Samal - The Programmer
by Biswajeet
3y ago
A lightning:formattedUrl component displays a read-only representation of a URL as a hyperlink with an href attribute. The link can be a relative or absolute URL. Sample Code: <aura:component> <aura:attribute name="recordId" type="String" default="0063X0000146rTLQAY"/> <lightning:formattedUrl value="{!'/' + recordId}" tooltip="Opportunity" label="Opportunity" /> </aura:component> ..read more
Visit website
Manage Knowledge Articles Using Apex
Biswajeet Samal - The Programmer
by Biswajeet
3y ago
Create new article: Knowledge__kav ka = new Knowledge__kav(); ka.Title = 'Salesforce CRM'; ka.UrlName = 'salesforce-crm'; ka.Summary = 'Salesforce Cloud CRM'; ka.Language = 'en_US'; insert ka; Publish a draft article: String knowledgeArticleId = 'kA06g000002AJ7t'; //Add knowledge article record id KbManagement.PublishingService.publishArticle(knowledgeArticleId, true); Unpublish a published article: String knowledgeArticleId = 'kA06g000002AJ7t'; //Add knowledge article record id KbManagement.PublishingService.publishArticle(knowledgeArticleId, true); Schedule archive of a published artic ..read more
Visit website
Create FeedComment Record in Apex Test Class
Biswajeet Samal - The Programmer
by Biswajeet
3y ago
Sample Code: //Parent Record Account acc = new Account(Name = 'Test Account'); insert acc; //Create Related Feed Item Record FeedItem fi = new FeedItem(ParentId = acc.Id, Body = 'Test Body'); insert fi; //Create Feed Comment Record FeedComment fc = new FeedComment(FeedItemId = fi.Id, CommentBody = 'Test Comment'); insert fc; //Get Feed Comment Record FeedComment objFC = [Select Id, CommentBody, FeedItemId, ParentId FROM FeedComment LIMIT 1]; //Check Feed Comment Parent Id System.assertEquals(objFC.ParentId, acc.Id ..read more
Visit website
LWC Multi Step Wizard
Biswajeet Samal - The Programmer
by Biswajeet
3y ago
LWCWizard.html <template> <lightning-progress-indicator current-step={currentStep} type="base" variant="base"> <lightning-progress-step label="Step 1" value="1" onclick={handleOnStepClick}></lightning-progress-step> <lightning-progress-step label="Step 2" value="2" onclick={handleOnStepClick}></lightning-progress-step> <lightning-progress-step label="Step 3" value="3" onclick={handleOnStepClick}></lightning-progress-step> </lightning-progress-indicator> <template if:true={isStepOne}> ..read more
Visit website

Follow Biswajeet Samal - The Programmer on FeedSpot

Continue with Google
Continue with Apple
OR