Skip to main content

Posts

Open Facebook Messenger | Open Chat Window | Send Message using Lightning Component Salesforce

Recent posts

Send WhatsApp and Save Chat using Lightning Component Salesforce | Salesforce Tutorials

Hello folks,
In this article you will learn to send WhatsApp and Save the Chat using Lightning Component Salesforce. 
Prerequisite : 
Create a custom object WhatsApp__c
Create custom fields as shown below : 


Please follow the code below : 

WhatsAppComponent 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30<aura:componentcontroller="Vlog_whatsappCTRL"implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction"access="global"><aura:attributename="recordId"type="String"/><aura:attributename="con"type="Contact"/><aura:attributename="msg"type="String"/><aura:handlername="init"action="{!c.doInit}"value="{!this}"/><articleclass="slds-card"><divclass="slds-card__header…

Sort Picklist Values in Lightning Component Salesforce | #Salesforce Tutorials

In this article you will learn to sort the values in Picklist in Lightning Component. You just have to add an additional line to your controller or helper of your Lightning Component.
In below code I am getting my Picklist values by "fetchPicklistValues" function. In the picklist I am having numeric values from 1 to 12.
Without sorting the result will be 1,10,11,12,2,3,4,5,6,7,8,9 but after sorting the result will be 1,2,3,4,5,6,7,8,9,10,11,12
Please check below code line number 18 for sorting.
Controller 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34fetchPicklistValues:function(component, fieldName, elementId, plType) { var action = component.get("c.getselectOptions"); action.setParams({ "objObject": component.get("v.objInfo"), "fld": fieldName }); var opts = []; action.setCallback(this, function(response) { if…

Formula to get time zone based on Area Code in Salesforce

In this article you will learn to create a formula to get the time zone based on Area Code in the phone number field in Salesforce.
Please follow below formula code :
if( ISBLANK(Phone),"--",

if( CONTAINS("206:209:213:253:310:323:360:408:415:425:503:509:510:530:559:562:604:619:626:650:661:702:707:714:760:775:778:805:818:831:858:867:909:916:925:949:951:971:236:250:604:778:867", left(SUBSTITUTE( Phone , "(", ""),3)),"UTC-8 Pacific",

if(
CONTAINS("208:250:303:307:385403:406:435:480:505:520:602:623:719:720:780:801:928:970:403:587:780", left(SUBSTITUTE( Phone , "(", ""),3)),"UTC-7 Mountain",

if(
CONTAINS("204:205:210:214:217:218:224:225:228:251:254:256:262:270:281:306:308:309:312:314:316:318:319:320:325:334:337:361:402:405:409:414:417:430:432:469:479:501:504:507:512:515:563:573:580:601:605:608:612:615:618:620:630:636:641:651:660:662:682:708:712:713:715:731:763:769:773:785:806:815:816:817:830:832:847:901…

APEX Trigger and Test Class to Prevent Account Deletion | #Salesforce Tutorials

In this article you will learn to create a Before Delete Trigger and Test Class to prevent Account deletion based on a field's value condition.
Please follow below code : 
Trigger 1 2 3 4 5 6 7 8trigger beforeAccDeletion on Account (before delete) { for(Account acc : trigger.old){ if(acc.myField__c !=null){ acc.adderror('Can not delete the Account if myField is available'); } } }
Test Class 1 2 3 4 5 6 7 8 9 10 11 12 13 14@isTest privateclass beforeAccDeletionTest { static testmethod void testAccDelete(){ Account acc =new Account(); acc.Name='Acc1'; acc.myField__c='AnyValue'; insert acc; try{ delete acc; }catch(DMLexception e){ system.assert(e.getMessage().contains('Can not delete the Account if myField is available'),'Can not delete the Account if myField is available'); } } }
Check other p…

Change Background Color in Lightning Data Table Salesforce

In this Article you will learn how you can apply some custom CSS in Lightning Data Table and change the Background and Text Colors.
Please follow below code : I have applied some custom css to below Lightning Data Table to change the Background Color, Text Color and Hover Color.
Note : You have to override default hover CSS.
Component.cmp 1 2 3 4 5<lightning:datatablekeyField="id"data="{! v.recordList}"class="myCss"columns="{! v.columns}"hideCheckboxColumn="true"/>
Style.css 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20.THIS { } .THIS .myCss thead th span{ background-color:#3258a8; color: white; } .THIS .myCss td { background-color:#fffbdb; color: black; } .THIS .myCss tr { background-color:#fffbdb; color: black; } .THIS .myCss td:hover { background-color:#ffed63 !important; color: black !important; font-weight:bold !important; }

Check other posts as well !

Please check below links also…