Posts

Showing posts from March, 2019

Show the Success Message before Redirecting the Detail page on Visualforce Page

Requirement: To show the Success message before Redirecting the Detail page. On Click on Save button show the successful message after that redirect to detail page.  Solution: Create the Controller Class public class ClassName { // Create a boolean property     public boolean isChanged{get;set;}             public void SaveData(){         //Write Save/update Logic //insert/update list or object /set the boolean value as a true after list update/insert isChanged=true;         ClassName              } // This method will call after saving the record. and redirect to specify id     public pagereference redirectToRequiredPage(){         PageReference pageRef=new PageReference('/' +Recordid);         return pageRef;     } } Create the visualforce page <apex:page Controller="ClassName" standardStylesheets="true" sidebar="true" showHeader="true"> <apex:form>     <apex:outputPanel id=&

How To Find Button Click Using Lightning Component

Image
Requirement: On LC there are two buttons. Both buttons have same function how to get which button have clicked. Solution Create a component ButtonClick.cmp <!--c: ButtonClicked -> <aura:component >     <aura:attribute name="whichButton" type="String" />          <p>You clicked: {!v.whichButton}</p>     <ui:button aura:id="button1" label="Click me" press="{!c.pressMe}"/>     <ui:button aura:id="button2" label="Click me too" press="{!c. pressMe }"/> </aura:component> /*  ButtonClicked Controller.js */ ({      pressMe : function(cmp, event, helper) {         var whichOne = event.getSource().getLocalId();         console.log(whichOne);         cmp.set("v.whichButton", whichOne);     } }) Create a app Test.app for Testing <aura:application extends="force:slds">          <c:ButtonClicked/> <!--

Open Model Pop Up Using Lightning Component

Image
Create the Component. Component Name: ModelPop.cmp <aura:component>          <aura:attribute name="isOpen" type="boolean" default="false"/>          <div class="slds-m-around_xx-large">         <lightning:button variant="brand"                           label="OpenPopUp"                           title=""                           onclick="{! c.openModel }" />                 <aura:if isTrue="{!v.isOpen}">             <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">                 <div class="slds-modal__container">                     <header class="slds-modal__header">                         <lightning:buttonIcon iconName="ut