You are here:
Add a New Action in the Actions List in the Cart Summary Pane (Managed Package)
In Enterprise Sales Management, you can display additional buttons in the cart summary pane, if required. By default, the cart summary pane displays a list of actions that you can perform, such as Create Order and Create Proposal. Let's say you want to add an action labeled Apply Adjustment. Here's how you can add this action in the actions list in the cart summary pane.
This feature is part of the Communications Cloud managed package.
Any new action can be added to the array of actions in the actions list by extending the component. To add an action in the actions list in the cart summary pane, you must extend the b2bSampleApp and the b2bCartSummary LWCs:
-
Create a new LWC by extending the b2bCartSummary
LWC.
- In your Enterprise Sales Management org, go to the App Launcher. Enter LWC and click LWC Designer.
- Click +LWC to create a new LWC.
- In the Add New LWC dialog box, click Extend.
- Enter the LWC name cb2bCartSummary.
- Select the LWC b2bCartSummary.
- Select Include HTML, Include XML Targets, and Omniscript Support.
- Click Create.
-
Create the HTML file for cb2bCartSummary.
- In Select a file, select cb2bCartSummary.html.
-
In the editor, enter the required HTML. You can use the following
HTML as a sample to create this file:
<template> <vlocity_cmt-b2b-cart-summary name-list={nList}> <!-- existing slot override --> <div slot="action"> <div class="nds-grid nds-grid_vertical-align-center nds-grid_align-end"> <div class="nds-large-order_1 nds-grid nds-grid_align-center nds-wrap"> <div class="nds-m-left_medium"> <vlocity_cmt-b2b-button theme="nds" variant="neutral" label={labels.CMEXAddProducts} icon-name="utility:add" icon-size="x-small" onclick={addProduct}> </vlocity_cmt-b2b-button> </div> <div class="nds-m-left_medium"> <vlocity_cmt-b2b-button theme="nds" variant="neutral" label={labels.CMEXCreateOrders} icon-size="x-small" onclick={createOrder}> </vlocity_cmt-b2b-button> </div> </div> <!-- utility actions code is needed here if customer wants to reuse the existing feature provided, along with the new button implementation--> <div class="nds-large-order_2 nds-b2b-m-left_medium"> <vlocity_cmt-menu theme="nds" icon-name="utility:threedots_vertical" position="right"> <template for:each={actionList} for:item="item"> <vlocity_cmt-menu-item theme="nds" name={item.label} key={item.label} record={item} data-method={item.method} onclick={executeAction}></vlocity_cmt-menu-item> </template> </vlocity_cmt-menu> </div> </div> </div> </vlocity_cmt-b2b-cart-summary> </template> - Save your work. Refresh your browser tab to confirm the changes were saved successfully.
-
Create the JavaScript file for
cb2bCartSummary.
- In Select a file, select cb2bCartSummary.js.
-
In the editor, enter the required JavaScript. In this example, the
action
applyAdjustmentis added with the labelApply Adjustment. You can use the following JavaScript as a sample to create this file:import B2bCartSummary from 'vlocity_cmt/b2bCartSummary'; export default class cb2bCartSummary extends B2bCartSummary { connectedCallback(){ super.connectedCallback(); //nList can be any variable, need to store the route Quote property this.nList = this.route.Quote; // modifying existing utility actions (add or remove) this.actionList.splice(0,0,{label:'Apply Adjustment',method:'applyAdjustment'}); } executeAction(evt){ const func = evt.currentTarget.dataset.method; this[func](); } applyAdjustment(){ //custom code here alert('Apply Adjustment'); } } - Save your work. Refresh your browser tab to confirm the changes were saved successfully.
-
Update the metadata XML file for
cb2bCartSummary.
- In Select a file, select cb2bCartSummary.js-meta.xml.
-
In the editor, update the metadata. Ensure that the metadata
specifies
isExposedastrueand theruntimeNamespaceasvlocity_cmt. You can use the following XML as a sample to update this file:<?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <runtimeNamespace>vlocity_cmt</runtimeNamespace> <masterLabel>cb2bCartSummary</masterLabel> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> </targets> </LightningComponentBundle> - Save your work.
-
Next, create a new LWC by extending the
b2bSampleApp LWC.
- Click +LWC to create a new LWC.
- In the Add New LWC dialog box, click Extend.
- Enter the LWC name cB2BSampleApp.
- Select the LWC b2bSampleApp.
- Select Include HTML, Include XML Targets.
- Click Create.
-
Create the HTML file for cB2BSampleApp.
- In Select a file, select cB2BSampleApp.html.
-
In the editor, enter the required HTML. You can use the following
HTML as a sample to create this file:
<template> <div class="via-nds"> <div if:true={initApp}> <c-cb2b-cart-summary></c-cb2b-cart-summary> <template if:true={route.memberUpload.active}> <vlocity_cmt-b2b-data-table-wrapper></vlocity_cmt-b2b-data-table-wrapper> </template> <template if:true={route.selectOffer.active}> <vlocity_cmt-b2b-offer-selection></vlocity_cmt-b2b-offer-selection> </template> <template if:true={route.configureOffer.active}> <vlocity_cmt-b2b-offer-config></vlocity_cmt-b2b-offer-config> </template> <template if:true={route.quoteSummary.active}> <vlocity_cmt-b2b-quote-summary></vlocity_cmt-b2b-quote-summary> </template> </div> <div class="slds-spinner_container" if:false={initApp}> <lightning-spinner alternative-text="Loading" size="large" variant="brand"></lightning-spinner> </div> </div> </template> - Save your work. Refresh your browser tab to confirm the changes were saved successfully.
-
Create the JavaScript file for
cB2BSampleApp.
- In Select a file, select cB2BSampleApp.js.
-
In the editor, enter the required JavaScript. You can use the
following JavaScript as a sample to create this file:
import B2BSampleApp from "vlocity_cmt/b2bSampleApp"; import cB2BSampleAppTemplate from "./cB2BSampleApp.html"; /** * @class cB2BSampleApp * @extends {LightningElement} Extends the b2bSampleApp * * @classdesc * cB2BSampleApp is the component for navigating between components.<br/><br/> */ export default class cB2BSampleApp extends B2BSampleApp { render(){ return cB2BSampleAppTemplate; } } - Save your work. Refresh your browser tab to confirm the changes were saved successfully.
-
Update the metadata XML file for
cB2BSampleApp.
- In Select a file, select cB2BSampleApp.js-meta.xml.
-
In the editor, update the metadata. Ensure that the metadata
specifies
isExposedastrueand theruntimeNamespaceasvlocity_cmt. You can use the following XML as a sample to update this file:<?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <runtimeNamespace>vlocity_cmt</runtimeNamespace> <masterLabel>cB2BSampleApp</masterLabel> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> </targets> </LightningComponentBundle> - Save your work.
-
Next, update the b2bSampleApp card. The
b2bSampleApp card can't be updated directly, so
start by cloning the card:
- In your Enterprise Sales Management org, go to Settings and click Setup.
- In Quick Find, enter Lightning and click Lightning Components.
- In the list of Lightning components, go to cfB2bSampleAppCard. Click Del and then click OK to confirm. If there are multiple components with the prefix cf, delete all of these components.
- In the App Launcher, enter Cards and click Vlocity Cards.
- Open b2bSampleAppCard and then click Clone.
- Enter a name in Layout Author and click Save.
- In the cloned card, in Layout LWC, select the custom LWC that you just created, cb2bSampleApp, and then click Deploy.
- Click Activate.

