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, 8 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 AI: How it Works for Sales Cloud?

    Blog in Salesforce Einstein

    Artificial intelligence (AI) long ago has become a full-fledged link in the interaction of Humans with technologies. AI successfully helps us to find what we…

    Artificial Intelligence, Boost Customer Experience, Business Scale, Commerce Cloud, Community Cloud
    Sparkybit Jan 25, 2023
    1,790  Views
    Client Credentials

    OAuth 2.0 Client Credentials Flow | Salesforce Developer Guide

    Blog in Salesforce

    OAuth 2.0 has a flow called Client Credentials that is useful when there are requests to APIs that don't involve the user. The client credentials…

    API, Applications, Auth0, Authentication Methods, Authentication Scheme
    Mohit Kumar Nov 7, 2022
    5,875  Views
    Salesforce Org Performance

    How to Measure Salesforce Org Performance

    Blog in Salesforce

    Numerous companies trust Salesforce CRM to maintain their workflow visibility, optimize processes, utilize the latest tools and advancements, sales and services enablements, etc., for continuously…

    API calls, Business, Business Resources, CRM Migration, CSS
    Melonleaf Aug 17, 2022
    6,967  Views

    Popular Salesforce Videos

    Email-to-Case Advance | Clean Case Comments

    Email-to-Case Advance | Clean Case Comments

    Video in Salesforce Products

    Save your support reps from ‘Click fatigue’ while hastening the resolution of customer cases. Get Email to Case Advance, the much-needed power booster for your…

    salesforce, email to case, support, cleancomments, grazitti
    Shubham Jul 23, 2019
    1,838  Views
    Guided Setup with Salesforce Field Service Administration - Webinar Recording

    Guided Setup with Salesforce Field Service Administration - Webinar Recording

    Video in Salesforce Field Service Platform

    Salesforce Field Service is a complete, end-to-end solution for customer service in the field. Salesforce Field Service brings together customers, employees, and products on a…

    Salesforce Service Cloud, salesforce, Salesforce Field Service, Service Cloud, customer service
    AblyPro Oct 27, 2023
    846  Views
    Leads & Opportunities for Lightning Experience - Create and Convert Leads

    Leads & Opportunities for Lightning Experience - Create and Convert Leads

    Video in Lightning

    Learning Objectives After completing this unit, you’ll be able to: Update a record’s stage or status using Path. Update records in the Kanban view. Use…

    Salesforce Training, Salesforce Lightning, salesforce, Trailhead, Salesforce Trailhead
    Vivek Apr 20, 2020
    2,484  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.