Posts

AuraConditionalRendering

When Checkbox is true Education is displayed   <aura:application   extends = "force:slds" >      <aura:attribute   name = "variable"   type = "Boolean"   />      <lightning:input   aura:id = "Education"   type = "checkbox"                      label = "Education"                        name = "Education"   value = "Education"             onchange = "{!c.handleCheck}"   />                                <aura:if   isTrue = "{!v.variable}" >          <div> Se...

AuraLocales

 Locales <aura:application extends="force:slds">     {!$Locale.language}<br/>     {!$Locale.timezone}<br/>     {!$Locale.numberFormat}<br/>     {!$Locale.currencyFormat}<br/> </aura:application> ({     checkDevice: function(component) {     var locale = $A.get("$Locale.language");     alert("You are using " + locale);     } }) O/p en America/Los_Angeles #,##0.### ¤#,##0.00;(¤#,##0.00)

AuraAttributes

Binding attribute in Application <aura:application   extends = "force:slds" >      <aura:attribute   name = "value"   type = "String"   default = "World" />     Hello {!v.value}! </aura:application> O/p Hello  World ! Hello World example sending value from js to server as param and getting output. Apex public  with sharing  class   helloWorldwithParam  {      @AuraEnabled      public   static   String   serverEcho ( String   firstName ) {          return  ( 'Hello from the server, '  +  firstName );     } } Application <!-- Adding classname of apexclass -->  <aura:application controller="helloWorldwithParam" extends="force:slds">     <aura:attribute name="firstName" type="String" default="...

Updating Date while deactivating user

 Create a custom field of text and date. /* While deactivating a user on User Object update field on msg__c and deactivatedate__c with current dd*/   Apex Class public class deactivateHelper{       public static Boolean isFirstTime = true;     public static void updateUser(Set<id> pxyUsrId){                  system.debug('====='+pxyUsrId);         //Getting the Id for the user         Id userId = [select id,msg__c from User where id in: pxyUsrId limit 1].Id ;        //  List<User> userListToDeactivate = [select id,msg__c from User where id in: ids];                          List<User> uselst = new List<User>();         if(pxyUsrId.size() > 0 ){             for(user us : [SELECT Id, msg__c,deactivated...

Activating/deactivating trigger based on custom setting

  Create a custom setting with Name  TriggerSupport; and Field Checkbox with Label  TriggerOff Click on Manage --->  Set Default value as true  Code for getting the custom setting value TriggerSupport__c support = TriggerSupport__c.getInstance('TriggerOff__c'); system.debug('support'+support.TriggerOff__c); Output:  USER_DEBUG [3]|DEBUG|supporttrue

Showing Apex Error on UI for Lightning WebComponents(lwc)

Image
 Template: <template>      <lightning-card   title = "Showing error From Apex" >          <lightning-button   label = "Get Contacts"   onclick = {handleGetContacts} ></lightning-button>                   <template   if:true = {error} >              <c-error-panel   errors = {error} ></c-error-panel>          </template>      </lightning-card> </template> Js:      import  {  LightningElement , wire  }  from   'lwc' ; //importing from apex import  srchval  from   '@salesforce/apex/showErrorMsg.showError' ; export default   class   ShowErrorfromApex ...

ToastMessage

 showInfoToast : function(component, event, helper) {         var toastEvent = $A.get("e.force:showToast");         toastEvent.setParams({             title : 'Info Message',             message: 'Mode is dismissible ,duration is 5sec and this is normal Message',             messageTemplate: 'Record {0} created! See it {1}!',             duration:' 5000',             key: 'info_alt',             type: 'info',             mode: 'dismissible'         });         toastEvent.fire();     },     showSuccessToast : function(component, event, helper) {         var toastEvent = $A.get("e.force:showToast");         toastEvent.setPar...