Customize Quote Studio sidebar with Extensibility Framework
Lightning web components (LWC) and Aura components are the two Salesforce programming models, based on which you can build Lightning components. LWC and Aura components can coexist in an app and interoperate with each other.
The CPQ X Extensibility Framework feature enables you to easily include your own LWC or Aura components in the Quote Studio sidebar. It can significantly improve the extensibility and usability of Quote Studio.
The high-level steps to customize Quote Studio sidebar are:
See the sections below for more information.
Create your own components
You must create your own Lightning web components or Aura components. See the following Salesforce documentation for steps about creating LWC or Aura components:
When creating components, you must ensure your component implementation meets the following requirements:
- The
pageState
,metricState
,quoteState
, andtextTitle
attributes must be declared as global attributes.Component type Code example LWC @api quoteState;
@api metricState;
@api pageState;
@api textTitleAura <aura:attribute name="quoteState" type="Map" access="global" />
<aura:attribute name="metricState" type="Map" access="global"/>
<aura:attribute name="pageState" type="Map" access="global"/>
<aura:attribute name="textTitle" type="String" access="global"/>
- Custom components must be declared globally or exposed.
Component type Code example LWC In LWC metadata file: <isExposed>true</isExposed>
Aura <aura:component access="GLOBAL">
- To persist any data changes within the Quote Studio page, the following events should be dispatched with the listed parameters:
Event type Parameter Parameter type Description Introduced in version Required to select the event action while component registration updateQuote quote Javascript object Overrides the existing quote with the parameter value and recalculates ramp intervals , and terms and conditions if necessary. A Preview an order call is initiated unless the Enable Preview On Demand Quote Studio admin setting is enabled. 10.4 Yes upsertQuoteLineItems quoteLineItems Javascript object Override existing list of quote line items with the parameter value. A Preview an order call is initiated unless the Enable Preview On Demand Quote Studio admin setting is enabled. 10.4 Yes addQuoteLinesItems - prodIds: a list of productRatePlan ids with one-time flat-fee charges
- effectiveDate
- prodIds: List
- effectiveDate: String
Add the one-time flat fee charges associated with the prodIds parameter as line items to the quote as of the effective date. A Preview an order call is initiated unless the Enable Preview On Demand Quote Studio admin setting is enabled. 10.4 Yes addProducts - prodIds: a list of productRatePlan ids
- effectiveDate
- prodIds: List
- effectiveDate: String
Adds the product rate plans listed in the prodIds parameter to the quote subscription as of effectiveDate. A Preview an order call is initiated unless the Enable Preview On Demand Quote Studio admin setting is enabled. 10.4 Yes updateProducts productTimelines Javascript object Overrides the existing productTimelines list with the parameter value. A Preview an order call is initiated unless the Enable Preview On Demand Quote Studio admin setting is enabled.
Note: This method does not initiate any recalculation of the fields on the product. The custom component is responsible for recalculating the associated fields such as Effective Price and Discount, if you manually change these field values.
10.4 Yes previewQuoteState N/A N/A Initiates a Preview an order call. 10.4 Yes saveQuote N/A N/A Saves the existing quote and triggers a Preview an order call. 10.4 Yes toastMessageDisplay - message
- theme: the value can be
warning
,error
, orsuccess
. - timeout: optional, defaults to 5000
- message: String
- theme: String
- timeout: Integer
Shows a toast message defined by the parameters. 10.4 No objectFieldConfig configs configs: Array of Javascript object
For more information related to Javascript object signature, see Signature for objectFieldConfig.
For dynamic field rendering, you can apply field config properties (background color, help text, read-only, disabled, hidden, textColor, and options) to Quote, Quote Rate Plan, Quote Rate Plan Charge, and Quote Amendment fields in Quote Studio. It overrides the object field config settings setup in Quote Studio Settings. 10.35.1 Yes changesidebarwidth width width: String Configure the sidebar width using Custom Code. The width can be any CSS-supported unit. We recommend responsive units like vw for responsive behavior. 10.36 No opensidebarcomponent componentName: Name of the custom component from sidebar to open componentName: String Opens the sidebar custom component. 10.36 No closesidebar N/A N/A Closes the sidebar. 10.36 No
For sample code, see Sample code for events.
Signature for objectFieldConfig
Property name | Type | Description | |
---|---|---|---|
field | String | API name of the field. [Required] | |
object | String | API name of the object. [Required] | |
chargeIndex | Number | Index of the charge in the Version of the Product Timeline | |
timelineId | String | Id of the timeline present in the Product Timeline | |
quoteId |
String |
Id of the quote | |
effectiveDate |
String |
Contract Effective date of the version/Rate Plan present in the Product Timeline | |
backgroundColor | String | Color to be applied to the field. (Colors are specified using predefined color names, RGB, HEX, HSL, RGBA, HSLA values.) If the default color needs to be applied - ‘default’ should be used as a color. | |
helpText | String | Value can be a string or null . If String, help text to be displayed next to the field. If help text needs to be removed, you can pass null as a value |
|
readOnly | Boolean | Value can be true or false . If true, make the field read-only. If false, make the field normal from read-only. |
|
disabled | Boolean | Value can be true or false . If true, make the field disabled. If false, make the field editable. |
|
hidden | Boolean | Value can be true or false . If true, make the field hidden. If false, make the field unhidden. |
|
textColortextColor | String |
This property will help apply text color to the fields on the quote studio UI. Text color to be applied to the field. (Colors are specified using predefined color names, RGB, HEX, HSL, RGBA, HSLA values.) If the default color needs to be applied - ‘default’ should be used as a textColor. |
|
options : [ ] | Array of JS Objects |
You can use this property to override the options for a picklist field in Quote Studio UI. Quote, QuoteRatePlan, and QuoteRatePlanCharge objects are supported. QuoteRatePlanCharge record-level updates are supported. Using product hooks with valid timelineId and chargeIndex, each charge field can be configured with different options. ‘isDefault’:true is not supported currently. However, any picklist value can be set through the updateQuote event. Dropdown fields other than picklist field type are not supported. Example: BillTo, SoldTo. Sets options to a picklist field. |
|
isDefault | Boolean | ||
label | String | ||
value | String |
Some properties are commonly available for all objects, such as field, object, readOnly, disabled, hidden, backgroundColor, helpText, textColor, and options.
Object | Properties available for use | Signature |
---|---|---|
zqu__Quote__c | quoteId |
{ } |
zqu__QuoteRatePlan__c | timelineId , effectiveDate |
{ field: 'Custom_Field__c', } |
zqu__QuoteAmendment__c | timelineId , effectiveDate |
{ field: 'zqu__ContractEffectiveDate__c', } |
zqu__QuoteAmendment__c (Future Dated Update Modal) | timelineId |
{ } |
zqu__QuoteRatePlanCharge__c | timelineId , chargeIndex , effectiveDate |
{ field: 'Custom_Field__c', } |
zqu__QuoteAmendment__c | timelineId , effectiveDate |
{ field: 'zqu__ContractEffectiveDate__c', } |
zqu__QuoteAmendment__c (Future Dated Update Modal) | timelineId |
{ } |
zqu__QuoteRatePlanCharge__c | timelineId , chargeIndex , effectiveDate |
{ field: 'Custom_Field__c', } |
Register and dispatch events
After your component is implemented, you need to register and dispatch events in your code implementation. See the following Salesforce documentation for instructions:
- For Aura components, see Fire Component Events.
- For LWC, see Create and Dispatch Events.
Aura example
If you want to register the updateQuote event for an Aura component, you can use the following sample codes:
<aura:registerEvent name="updateQuote" type="zqu:quoteUpdate"/>
Then use the following code to fire the event:
let quote = component.get("v.quoteState.quote"); let updateQuote = cmp.getEvent("updateQuote"); updateQuote.setParams({ quote: quote }); updateQuote.fire();
LWC example
When dispatching custom events in LWC, it is important to adhere to the standard of using all lowercase letters for event names. Uppercase letters are not allowed in custom event names as per LWC guidelines. Here's an example to illustrate this:
const updateQuote = new CustomEvent('updatequote', { detail: { quote: this.quoteState.quote }, }); this.dispatchEvent(updateQuote);
Register custom component in CPQ X
After you have completed the code implementation of your components, you must register your components in CPQ X so that the custom UI components are rendered in the Quote Studio sidebar.
Take the following steps to register a custom component in CPQ X:
- Navigate to Zuora Config > Quote Studio Settings > Custom Component Settings.
- Click the Create New Component button.
- Complete the component information for registration.
- (Optional) Component Namespace: Enter the namespace of your component.
- Component Name: Enter the name of the component.
- Component Type: Select Aura or LWC from the dropdown lists.
- (Optional) Component Event Action: Select the event actions you want to handle in your component.
Sometimes, after you upgrade your Zuora CPQ package from the previous version, newly created events in the upgraded package might not be available. In such cases, you will have to create the event picklist with the value and name as the one present in Event Type for the field zqu__Component_Event_Action__c in the object zqu__Add_on_component_registration__c - (Optional) Use as Headless Component: Check this box to designate the component as headless. For more information, see Headless component.
Headless Components will not appear in the Quote Studio Sidebar. - Active: Select this check box if you want to activate the registered component on registration.
- Sort Order: Enter the number of the sequence number such as
1
. The registered components are sorted and displayed in the ascending order based on the Sort Order value. - (Optional) Title Text: The title text for the registered component.
- Image Resource Name: Enter the name of your component. It should be identical with the name of the image file that is uploaded to static resource in Salesforce.
- Click Create.
If the created component is added to the table in the Manage Existing Components tab, the component is successfully registered.
Update display order of custom components
If you have registered multiple custom components, you can customize the display order of these components.
Take the following steps to update the display order of registered components:
- Navigate to Zuora Config > Quote Studio Settings > Custom Component Settings.
- Click the Update Order button.
- Edit the number in the Order column for different entries. The components are sorted in the ascending order of the Order value. Therefore, if you want to move a component to the top, you should specify the lowest value in the Order column for this item, and vice versa.
- Click Save to save the change.
After your updates are saved, the registered components are reorganized based on the updated Order value.