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, 5 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

    Salesforce Einstein Activity Capture Guide in 2024

    Blog in Salesforce Einstein

    Have you ever had issues maintaining accurate, up-to-date information between your Salesforce org and your clients? Einstein Activity Capture is here to work for you…

    AppExchange, Automation, Chatter, Digital Transformation, Einstein Activity Capture
    DB Mar 21, 2024
    915  Views
    covid response solution

    Instantly Deploy Free COVID-19 Care Response Solution with Global Salesforce Implementation Partner

    Blog in Salesforce

    World leaders and global health care providers are overwhelmed with inbound calls and an amplified number of cases they are receiving each day affected by…

    Artificial Intelligence, Communities Cloud, Community Cloud, CRM, Customer Data
    Reena Jun 8, 2020
    16,244  Views

    Meet Astro, Codey & Friends | The Salesforce Trailhead Family

    Blog in Salesforce

    Salesforce changed the way people perceived business software when it launched in 1999. Marc Benioff, CEO of Salesforce, imagined making software easier to buy, use…

    AppExchange Environment, Appy, Artificial Intelligence, Astro, builder
    Apphienz Apr 19, 2021
    3,643  Views

    Popular Salesforce Videos

    EPC and CPQ in Salesforce Industries (Vlocity)

    EPC and CPQ in Salesforce Industries (Vlocity)

    Video in Salesforce Stories, Salesforce Communities

    Enterprise Product Catalog (EPC) to configure and manage CPQ in one place. It's a guided selling experience for users to build an order. While CPQ…

    Salesforce Training, Salesforce Tutorial, salesforce, CPQ, Salesforce Video
    Cyntexa Oct 26, 2022
    4,019  Views
    Use Salesforce CMS to Manage and Publish Content for Experience Cloud Sites

    Use Salesforce CMS to Manage and Publish Content for Experience Cloud Sites

    Video in Salesforce Cloud Platform

    Learn how Salesforce CMS helps you create, manage, and publish your content in Experience Cloud. With Salesforce CMS, you can also customize content for specific…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Video, Salesforce Learning
    Jogender Apr 25, 2022
    2,473  Views
    Manage Record Access and Visibility in Salesforce

    Manage Record Access and Visibility in Salesforce

    Video in Salesforce Training

    Watch this video to learn all about managing record access and visibility in Salesforce. Do let us know in the comment section if you have…

    Salesforce Training, Salesforce Tutorial, Salesforce Records, Salesforce Video, Salesforce Learning
    Pooja Nov 18, 2021
    1,998  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.