Loading
Get Started with Communications, Media, and Energy & Utilities (CME)...
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          JavaScript refreshGraph Method for Lightning Web Components

          JavaScript refreshGraph Method for Lightning Web Components

          If you embed a Relationship Graph in another Lightning Web Component, you can use the JavaScript refreshGraph method to refresh the Relationship Graph. For example, if another embedded Lightning Web Component lets you change data that might affect the graph, that Lightning Web Component component can refresh the graph after any such change.

          For simplicity, the example here shows a Lightning Web Component with two embedded components: a Relationship Graph, and a button that invokes the refreshGraph method.

          To embed a Relationship Graph, include a namespace-graph element in the .html file, where the namespace is omnistudio, vlocity_cmt, vlocity_ins, or vlocity_ps. For example:

          <template>
              <lightning-button label="Refresh Graph" onclick={refreshChildGraph}> </lightning-button>
              <vlocity_ins-graph graph-type="Radial Graph" graph-id="a164W000007mHKQQA2" record-id="0014W000029eFesQAE"> </vlocity_ins-graph>
          </template>

          Call the refreshGraph method in the .js file. For example:

          import { LightningElement } from 'lwc';
          export default class rgGraphRefresh extends LightningElement {
              refreshChildGraph(){
                  this.template.querySelector('vlocity_ins-graph').refreshGraph();
              }
          }

          The method signature is:

          @api refreshGraph(hardRefresh = true) {}

          The hardRefresh parameter is set to true by default. A soft refresh only moved nodes to their original positions. A hard refresh updates the object and template data in the graph. For a soft refresh, include (hardRefresh = false) in the method call.

           
          Loading
          Salesforce Help | Article