Skip to main content

Headless component

Zuora

Headless component

Introduces Headless Component that can trigger custom component logic upon Quote Studio events.

Headless Component expands the capabilities of the Extensibility Framework Custom Components. With this, you have the ability to trigger custom component logic upon Quote Studio events.

From Quotes version 10.21 or later, you can designate components as Headless component, which are components without a user interface (UI). These components can be harnessed to execute your extensibility framework custom component logic based on Quote Studio events, specifically save or submit events.

Note that only a single active Headless Component is permissible.

Use component as headless component

You can create global methods for Quote Studio hooks that can be executed in response to Quote Studio events. The following are the hooks available in the extensibility framework:

Method name Introduced in version

beforeSave

10.21

beforeSubmit

10.21

beforePreviewCall

10.21

beforeProductAdd

10.34
afterProductAdd 10.34
beforeProductUpdate 10.34
afterProductUpdate 10.34
beforeRulesExecution 10.34
afterRulesExecution 10.34
beforeSubmitNavigation 10.37
afterQuoteUpdate 10.37

beforeSave

This hook triggers when the Save button is clicked in Quote Studio.

Method name Input parameter Return parameter Description
beforeSave N/A

Boolean (optional)

(default: true)

Based on the returned boolean value, the save logic is executed.
  • When the returned value is TRUE, Quote Studio continues the save method logic execution.
  • When the returned value is FALSE, Quote Studio stops the save method logic.

beforeSubmit

This hook triggers when the Submit button is clicked in Quote Studio.

Method name Input parameter Return parameter Description
beforeSubmit N/A

Boolean (optional)

(default: true)

Based on the returned boolean value, the submit logic is executed.

  • When the returned value is TRUE, Quote Studio continues the submit method logic execution.
  • When the returned value is FALSE, Quote Studio stops the submit method logic.

beforePreviewCall

This hook triggers the Preview Call in Quote Studio. (Only applicable for Preview on-demand).

Method name Input parameter Return parameter Description
beforePreviewCall N/A

Boolean (optional)

(default: true)

Based on the returned boolean value, the preview call logic is executed.

  • When the returned value is TRUE, Quote Studio continues the preview call method logic execution.
  • When the returned value is FALSE, Quote Studio stops the preview call method logic.

beforeProductAdd

This hook triggers when the product add button is clicked, executing before the product addition logic runs (before the product is added to the UI).

This hook is executed only when the product is added from UI.

Input

Parameter

Type

Values

newRatePlanMap

JS object

Object of Product Rate Plan Ids along with quantities.

effectiveDate

String

Effective Date for which Product Rate Plans is added.

Return

Parameter

Type

Value

Description

proceed

Boolean

true

Quote Studio continues the product add logic execution. Send this parameter with other parameters.

false

If you don’t want to proceed with product add logic execution, you can return {proceed: false}

newRatePlanMap

JS object

Object of Product Rate Plan Ids along with quantities. New Rate Plan Map to be considered for further processing.

If you proceed with productAdd, you can return:

  • {proceed: true, newRatePlanMap, effectiveDate} 
    or
  • {proceed: true, newRatePlanMap}

Signature

@api
beforeProductAdd(newRatePlanMap, effectiveDate) {
   //add logic
   return { proceed: true, newRatePlanMap, effectiveDate }
}

afterProductAdd

This hook triggers when the add product button is clicked, executing after the product addition logic runs (after the product is added to the UI).

This hook is executed only when the product is added from UI.

Input

Parameter

Type

Values

newProductTimeline JS object

Object of newly added Product Timelines (Read only - cannot make any updates).

Return

N/A

Signature

@api
afterProductAdd(newProductTimeline) {
   //add logic
}

beforeProductUpdate

This hook triggers after making any update on the product (charge, amendment, rate plan, future dated update, revert on future dated update, or revert on future dated -  remove), executing before the product update logic.

This hook is executed only when the product is updated from UI.

Input

Parameter

Type

Values

Description
updatedCharges Array

An array of objects of updated charge record

For charge update, future dated update, or future dated update - revert, the value is an array of objects representing the updated charge record.

For future dated update - revert, the updated charges contains an array of charges to be reverted.

null

For amendment update, rate plan update, or future dated remove - revert, the value is null.
updatedAmendment JS Object Object of updated amendment record (Property: amendment) and specific update date (Property: specificUpdateDate) (If applicable) For amendment update, the value is as mentioned in the value column.
Object of updated amendment record

For a future dated update, future dated update - revert or future dated remove - revert, the value is an object of updated amendment record.

For future dated update - revert or future dated remove - revert, the updated amendment contains object of amendment record that is to be reverted.

null For charge update or rate plan update, the value is null.
updatedRatePlan

 

JS Object

Object of updated quoteRatePlan record

For rate plan update, future dated update, future dated update - revert or future dated remove - revert the value is an object of updated Quote Rate Plan record.

For future dated update - revert and future dated remove - revert, the updated rate plan contains object of updated Quote Rate Plan record that is to be reverted.

null For charge update or amendment update, the value is null.
isRevert Boolean true For future dated update - revert or future dated remove - revert, the value is True.
false For charge update, rate plan update, amendment update or future dated update, the value is False.

Return

Parameter

Type

Value

Description

proceed

Boolean

true

Proceeds with product update. Send this parameter along with other parameters mentioned in this table.

false

If you do not want to proceed with product update you can return {proceed: false}

updatedCharges Array An array of objects of updated charge record to proceed for the update Return this parameter for a charge update or future dated update.
updatedAmendment JS Object Object of updated amendment record and specific update date (If applicable) to proceed for the update Return this parameter for an amendment update or future dated update.
updatedRatePlan JS Object Object of updated Quote Rate Plan record to proceed for the update Return this parameter for a rate plan update or future dated update.

Return Signatures

  • For a charge update, Return { updatedCharges, proceed: true | false } 
  • For an amendment update, Return { updatedAmendment, proceed: true | false } 
  • For a rate plan update, Return { updatedRatePlan, proceed: true | false} 
  • For a future dated update, Return { updatedCharges, updatedRatePlan, updatedAmendment, updatedRatePlan, proceed: true | false } 
  • For a future dated update - revert, Return { proceed: true }
  • For a future dated remove - revert, Return { proceed: true }

Signature

@api
beforeProductUpdate(updatedCharges, updatedAmendment, updatedRatePlan, isRevert) {
//add logic
return { updatedCharges: [], proceed: true}
}

afterProductUpdate

This hook triggers after making any update on the product like charge, amendment, rate plan, future dated - updates, future dated update - revert or future dated remove - revert, executing after the product update logic.

This hook is executed only when the product is added from UI.

Input

Parameter

Type

Values

Description
updatedCharge Array An array of object of updated charge record

For charge update or future dated update, the value is an array of objects of updated charge record.

Null

For amendment update, rate plan update, future dated update - revert, or future dated remove - revert, the value is null.
updatedRatePlan Array An array of product version that was updated For charge update, amendment update, rate plan update, or future dated update, the value is an array of product version that was updated.
Remaining versions of product after revert For a future dated update - revert or future dated remove - revert, the value is an array of remaining versions of product after revert.

Return

N/A

Signature

@api
afterProductUpdate(updatedCharge, updatedRatePlan) {
 //add logic
}

beforeRulesExecution

This hook helps to run the custom logic before running the rules. This allows the following functionalities:

  • Filter the rules
  • Skip or run rules execution

The input and return types of this hook are both JSON objects.

In Quotes version 10.37, the following parameters are added to the return type of the hook.

  • forceExecuteRules parameter - You can use this parameter to run the rules regardless of the triggering conditions, Active field status, or other conditions.
  • includeRemovedRatePlan parameter - You can use this parameter to include the future dated remove rate plan in the rules engine.

Signature

@api
async beforeRulesExecution(context) {
      // Execute the logic
      return {
          rulesToExecute : [],
          runRules : true,
      }
}

Parameter


Type

Field

Values

Context JS Object triggerEvent

InitialLoad

Everytime

SaveSubmit

Return

Parameter

Type

Value

Description

rulesToRun

Holds the ZRule Ids

Array

Empty All the rules are executed.

Filled

Specified list of ZRule Ids are executed.

runRules

Boolean True Rules are executed.
False Rules are skipped. 
forceExecuteRules Boolean True Executes the selected rules irrespective of triggering conditions, Active field status, or other conditions.
False Execute the rules based on the triggering condition and Active field status.ield status.
includeRemovedRatePlan Boolean True

Custom action plugin executes, including future dated remove rate plans.

Quote Rate Plan Charges removed using remove product action are not included in the object structure.

False Custom action plugin executes excluding future dated remove rate plans.

If runRules is not provided in the return statement, the default value is true, and the rules engine is executed.

@api pageState contains the rules data if the fields are added to fieldset CPQX Rule Fields on the ZRule__c object.
 
Rules are listed as active and inactive based on the zqu__Active__c field. If this field is not added to the fieldset by default all the rules would be added to the inactive list.

pageState : {
      rules : {
          active: [],
          inactive: []
      }
  }

Custom Fields

Product Rate Plan fields added to the below fieldset would be available in @api quoteState in the extensibility framework.

Object Fieldset name
ProductRatePlan CPQX Rules Engine Custom Fields.

Custom Action Plugin

Product Rate Plan and Product Rate Plan Charge records can be accessed in a custom action plugin.

Product Rate Plan and Product Rate Plan Charge custom fields can be accessed in a custom action plugin when the custom fields are added into the following fieldsets.

Object Fieldset name
ProductRatePlan__c CPQX Rules Engine Custom Fields.
ProductRatePlanCharge__c CPQX Rules Engine Custom Fields.

afterRulesExecution

This hook triggers after the rules are executed.

Input

Parameter

Type

Values

rulesResponse JS Object

Contains 

Actions [ ] → Actions performed

Messages [ ] → Messages returned from the rule

newlyAddedTimelines { } → product timeline of newly added products as part of rules execution

rulesMatched (Number) → Rules that are matched and executed

success (Boolean) → returns the status of execution 

updatedQuoteState { } → Returns the updated quoteState after rules execution.

Return

N/A

Signature

@api
afterRulesExecution(rulesResponse) {
//add logic
}

beforeSubmitNavigation

This hook triggers when the submit button is clicked, executing immediately after the submit logic and before redirecting to the next page from Quote Studio.

Return

Parameter Type Value Description
proceed

 

Boolean True Proceed with redirection to the next page.

False

Do not proceed with redirection to the next page.
redirectionURL String Redirection URL (Optional) This property redirects the page to the given URL. If it is not returned, redirect the page to the default next page.

Signature

@api
beforeSubmitNavigation() {
   //add logic
   return { proceed: true };
}

afterQuoteUpdate

This hook triggers after making any update on the quote field and executing after the Quote update logic.

This hook is executed only when the product is added from UI.

Parameter

Type

Values

oldQuote JS Object

Object of quote record before the quote update.

newQuote JS Object Object of quote record after the quote update.

Signature

afterQuoteUpdate(oldQuote, newQuote) {
   // add Logic
}

For a sample code that uses the hooks mentioned in this article, see Sample code for hooks.