Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Marketplace
    • Advertise With Us
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › Refresh Lightning component on Opportunity record Edit Save (Standard Layout)

    Tagged: Account, Contact, Force RefreshView, Lightning UI, Opportunity Record, Salesforce Apex Controller, Salesforce Lightning, Salesforce Lightning Components, Standard Layout

    • Salesforce® Discussions

      Refresh Lightning component on Opportunity record Edit Save (Standard Layout)

      Posted by Danna on April 20, 2016 at 9:42 AM

      Trying to build a lightning component which would be used on the Opportunity Lightning UI. It loads perfectly on the right side panel and on the Opportunity record view but when I try to update the record the right panel doesn’t get refreshed. Searching for a way to refresh the lightning component saved on record. Any help or suggestion on force:refreshview is appreciate.

      Dave replied 9 years, 6 months ago 3 Members · 2 Replies
      • Account
      • Contact
      • Force RefreshView
      • Lightning UI
      • Opportunity Record
      • Salesforce Apex Controller
      • Salesforce Lightning
      • Salesforce Lightning Components
      • Standard Layout
    • 2 Replies
    • Piyush

      Member
      April 25, 2016 at 11:10 AM

      Hello Danna,

      Here is the code from my test app. My use case was in context of the Accounts and contacts but it should apply to any object. As far as my understanding when ever an object is saved then the current view is refreshed. This is visible by the spinner that is displayed over the top panel of the object. I added a handler to my component that uses the force:refreshView (https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_force_refreshView.htm) and just recalled my init method but could call another method if need be. This basically ensured that any time the object that was hosting the component was refreshed that my component would also refresh as well.

      Here is the Component Code:

      <aura:component controller="editRecordSimulationController"
      implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId,force:hasSObjectName">
      <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
      <aura:dependency resource="markup://force:editRecord" type="EVENT" />
      <aura:handler event="force:refreshView" action="{!c.doInit}" />
      <aura:attribute name="recordId" type="string" />
      <aura:attribute name="accType" type="String" />
      <aura:attribute name="accObj" type="account" default="{ sObjectType: 'Account'}"/>
      <ui:inputText label="Record Id" value="{!v.recordId}" required="true"/>
      <ui:button class="btn" label="Submit" press="{!c.setOutput}"/>

      <br />
      <br />
      <br />
      Account Type: <ui:outputText value="{!v.accObj.Type}" />
      </aura:component>

      Here is my Controller Code:

      ({
      doInit : function(component, event, helper) {
      var recordId = component.get("v.recordId");
      var action = component.get("c.getTypeFromAccount");
      action.setParams({
      recordId: recordId
      });
      action.setCallback(this, function(response){
      var state = response.getState();
      if (state === "SUCCESS") {
      var acc = response.getReturnValue();
      component.set("v.accType", acc.Type);
      component.set("v.accObj", acc)
      }
      });

      $A.enqueueAction(action);
      },
      setOutput : function(component, event, helper) {
      var editRecordEvent = $A.get("e.force:editRecord");
      editRecordEvent.setParams({
      "recordId": component.get("v.recordId")
      });
      editRecordEvent.fire();
      }
      })

      Here it the APEX controller code:

      public class editRecordSimulationController {

      @AuraEnabled
      public static Account getTypeFromAccount(string recordId)
      {
      Account acc = [select Name, Type from Account Where Id = :recordId limit 1];
      return acc;
      }
      }

    • Dave

      Member
      August 3, 2016 at 9:07 PM

      Helps if you give credit:

      https://developer.salesforce.com/forums/?id=906F0000000DDaqIAG

       

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    application solution

    Popular Salesforce Blogs

    How to Add or Delete Dynamic Rows in Salesforce using Lightning Web Component

    Blog in Lightning

    Introduction: Lightning includes the Lightning Component Framework and some exciting tools for developers. Lightning makes it easier to build responsive applications for any device. Lightning…

    AppExchange, Lightning App, Lightning Controller, Lightning Web Components, Salesforce Developer Console
    Piyush Dec 4, 2019
    22,264  Views
    Salesforce Community Cloud

    Salesforce Product : Community Cloud

    Blog in Salesforce Cloud Platform

    Salesforce Product: Community Cloud Community Cloud can determine either a portal, a help forum, a support site, HR central, or something else, an online community…

    Business Client Customer Support Community, Cloud Platform, Customer Service, Individual Client Customer Support Community, Salesforce Cloud Platform
    Archit Feb 14, 2018
    6,250  Views

    Einstein Activity Capture | The Ultimate Guide

    Blog in Others

    Einstein Activity Capture Salesforce Einstein Activity Capture is a powerful tool that enables businesses to keep track of their customer interactions and activities. It is…

    Artificial Intelligence, Automated Tracking, Calendar Accounts, Calendar Sync, Collaboration
    Rahul Jul 13, 2023
    2,385  Views

    Popular Salesforce Videos

    Public Groups In Salesforce | Salesforce Development Tutorial

    Public Groups In Salesforce | Salesforce Development Tutorial

    Video in Salesforce Training

    Public Groups In Salesforce. In this video, the following points will be covered - 1. Introduction Get a brief introduction about public groups. 2. Purpose…

    Salesforce Training, Salesforce Tutorial, Salesforce Development, Salesforce Development Tutorial, Salesforce Video
    Algoworks Aug 17, 2021
    2,328  Views
    Learn About the Salesforce Products in this Tutorial Video

    Learn About the Salesforce Products in this Tutorial Video

    Video in Salesforce Products

    Salesforce is a top-rated CRM that offers businesses a diverse range of products to enhance their business model and operations. With each Salesforce product specifically…

    Salesforce Training, Salesforce Products, Salesforce Sales Cloud, salesforce, CRM
    Vivek Jun 21, 2022
    2,910  Views
    Salesforce Summer ’22 Release | Flow Enhancement of Summer 22 Release with Example

    Salesforce Summer ’22 Release | Flow Enhancement of Summer 22 Release with Example

    Video in Salesforce Stories

    Exceed your business goals with the Summer ’22 release by seamlessly integrating your data, finding meaningful insights, and building lifelong customer relationships. How to Use…

    Salesforce Training, salesforce, Salesforce Video, Salesforce Learning, Release Notes
    Rupal Kakkar May 13, 2022
    1,666  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2026 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    Try AuditMyCRM - It is a Salesforce CRM Audit tool which comprehensively scans your Salesforce org and gives you the list of errors or warnings you need to take care of.
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.