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, 4 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 Outsourcing Services

    Top 15 Reasons to Choose Salesforce Outsourcing Services

    Blog in Salesforce

    CRM is the heart of most of the business and Salesforce is the king of the market! When it comes to adding to the productivity…

    Beneficial Solutions, Business, Business Needs, Business Requirement, Business Suffering
    SP May 25, 2021
    1,939  Views
    spring 20 release

    Salesforce Spring ’20 Release Notes - Top Features

    Blog in Salesforce Releases

    Salesforce Spring '20 Release have been made universally accessible on February 17, 2020. The Spring '20 discharge conveys extended advancements over the whole Customer 360…

    Aura Components, Best Practices, Customer 360 stage, Lightning Experience, Lightning Experience Configuration
    MOHIT Apr 15, 2020
    3,045  Views
    Salesforce Campaigns

    Learn All About Salesforce Campaigns

    Blog in Salesforce

    What are Salesforce Campaigns A Salesforce Campaign is a group of Leads and Contacts exposed to specific marketing communication(s). It stores essential performance metrics and…

    Apps, Campaign Field History, Campaign Hierarchies, Campaign Member, Campaign Members
    Ciprian Ungureanu Mar 21, 2022
    4,267  Views

    Popular Salesforce Videos

    The New Salesforce Nonprofit Cloud: How To Upgrade

    The New Salesforce Nonprofit Cloud: How To Upgrade

    Video in Salesforce Products

    The new Salesforce Nonprofit Cloud is an innovative platform tailored specifically to enhance the operations and effectiveness of nonprofit organizations. This advanced solution provides a…

    salesforce, Salesforce For Nonprofits, Nonprofit Success Pack, Salesforce Nonprofit Cloud, Nonprofits
    DB Jun 20, 2024
    530  Views
    Salesforce Admin Beginners Tutorial - 3.1 - Salesforce Platform Basics

    Salesforce Admin Beginners Tutorial - 3.1 - Salesforce Platform Basics

    Video in Salesforce Training

    Salesforce is an innovative tool that can be very powerful when used properly. That’s why it’s important to find effective and trustworthy ways to learn…

    Salesforce Tutorial, Salesforce Certification, Salesforce Administrator Training, Salesforce Administrator, salesforce platform
    Shiv Kumar Sharma Mar 8, 2018
    2,413  Views
    Salesforce Consent Management

    Salesforce Consent Management

    Video in Salesforce Products, Salesforce Training

    Consent Management: Track Customer Consent and Honor Opt-Out Requests. Track your customers' approval for how your company interacts with them. To help you assess your…

    Salesforce Training, Salesforce Video, data protection, Salesforce Learning, Company
    Abhishek Jul 14, 2021
    1,550  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

    © 2025 - 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.