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

    ClickJack Protection for Salesforce

    ClickJack Protection for Salesforce

    Blog in Others

    ClickJacking name sounds like an unfamiliar jargon for those who have never heard of it. Let me clarify it for you, it is a technique…

    ClickJack Protection, ClickJacked Page, ClickJacking, ClickJacking in Salesforce, Framebusting
    Manpreet Jan 24, 2018
    24,624  Views
    Salesforce Product - Sales Cloud

    Salesforce Product : Sales Cloud

    Blog in Sales, Salesforce, Salesforce Cloud Platform

    Salesforce: Sales Cloud Overview Sales Cloud is a part of CRM and a product of Salesforce which is mainly created for salespeople because it's such…

    Dashboards in Salesforce, Features of Salesforce Sales Cloud, Sales Cloud Data, Sales Cloud License, Sales cloud of Salesforce
    Archit Jan 29, 2018
    5,322  Views

    New Conversation Channels in Salesforce Essentials: What Do They Mean To Customers?

    Blog in Salesforce Products

    Businesses are increasingly leveraging mobile and Social media platforms to reach billions of customers instantly and deliver personalized and connected customer experiences across channels at…

    CRM, Salesforce Chatter, Salesforce Editions, Salesforce Essentials, Salesforce instance
    DemandBlue Sep 23, 2019
    2,421  Views

    Popular Salesforce Videos

    Why Are Some of The World’s Biggest Brands Transitioning Towards Headless? | Salesforce

    Why Are Some of The World’s Biggest Brands Transitioning Towards Headless? | Salesforce

    Video in

    With the advancement of headless architecture, consumers can now enjoy an omnichannel shopping experience. But that's not all that headless commerce has to offer. Leading…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Webinar, Salesforce Learning
    Cyntexa Aug 31, 2022
    1,308  Views
    Keep Salesforce Field Values Clean in Summer 20 in less than 10 minutes - Salesforce Break

    Keep Salesforce Field Values Clean in Summer 20 in less than 10 minutes - Salesforce Break

    Video in Salesforce Stories

    Keep Salesforce Mobile Phone field clean by stripping out the ()- characters from the user entry. Ensuring data quality is a challenge for every Salesforce…

    Salesforce Administrator, salesforce, Salesforce Admin, Salesforce Video, Salesforce Summer 20
    Jogender Jun 1, 2020
    1,625  Views
    Customized Ideas Management on Salesforce Experience Cloud | IdeasPro by Grazitti

    Customized Ideas Management on Salesforce Experience Cloud | IdeasPro by Grazitti

    Video in Salesforce Communities

    Learn how IdeasPro enables you to drive business growth by making the most of ideas on Salesforce communities, in this video.

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Community, Salesforce Learning
    Sukhwinder Singh Jul 29, 2022
    3,373  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.