Skip to main content

Headless component

Zuora

Headless component

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

From Quotes version 10.21 or later, you can designate components as Headless 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 will trigger 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 will be executed.
  • When the returned value is TRUE, Quote Studio will continue the logic execution of the save method.
  • When the returned value is FALSE, Quote Studio will stop the save method logic.

beforeSubmit

This hook will trigger when the Submit 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 submit logic will be executed.

  • When the returned value is TRUE, Quote Studio will continue the submit method logic execution.
  • When the returned value is FALSE, Quote Studio will stop the submit method logic.

beforePreviewCall

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

Method name Input parameter Return parameter Description
beforeSave N/A

Boolean (optional)

(default: true)

The preview call logic will be executed based on the returned boolean value.

  • When the returned value is TRUE, Quote Studio will continue the preview call method logic execution.
  • When the returned value is FALSE, Quote Studio will stop the preview call method logic.

beforeProductAdd

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

This hook will be 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 will be added

Return

The return type of this hook is JSON object.

Parameter

Type

Value

Description

proceed

Boolean

true

Quote Studio will continue 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. The New Rate Plan Map is to be considered for further processing.

If you proceed with productAdd, you can return:

{proceed: true, newRatePlanMap} 

effectiveDate (Optional)

String

The Effective date is to be considered for further processing.

If you proceed with productAdd, you can return:

{proceed: true, newRatePlanMap, effectiveDate}

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

afterProductAdd

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

This hook will be 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 will trigger 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 will be executed only when the product is updated from UI.

Input

Parameter

Type

Values

Description
updatedCharges : [ ] Array

array of object of updated charge record

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

For future dated update - revert, the updated charges contain 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

For a future dated update, future dated update - revert or future dated remove - revert, the value is 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.

amendment JS Object object of updated amendment record For amendment update, the value is as mentioned in the value column.

 

specificUpdateDate String Date used for specific update [If Applicable]
    null When it’s a 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 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

The return type of this hook is JSON object.

Parameter

Type

Value

Description

proceed

Boolean

true

Proceeds with product update. Send this parameter along with the other parameters below.

false

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

updatedCharges: [ ] Array array of object of updated charge record to proceed with the update Return this parameter for a charge update or future dated update.
updatedAmendment: { } JS Object object of updated amendment record Return this parameter for an amendment update.
updatedAmendment: { }   JS Object   Return this parameter for an amendment update.
amendment JS Object object of updated amendment record to proceed for update
specificUpdateDate String

Date used for the specific update to proceed for update [If Applicable]

updatedRatePlan: { }   JS Object object of updated Quote Rate Plan record to proceed with 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 will trigger after making any update on the product (charge, amendment, rate plan, future dated - updates, future dated update - revert, or future dated remove - revert), executing after the product update logic.

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

Input

Parameter

Type

Values

Description
updatedCharge : [ ] Array Array of object of updated charge record

For charge update or future dated update, the value is an array of object 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 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 object of updated rate plan data with charges, amendment, and rate plan details.
Remaining versions of product after revert When it’s a future dated update - revert or future dated remove - 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 will allow the following functionalities:

  • Filter the rules
  • Skip/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 remove rate plan in the rules engine.

Signature

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

Input 

Parameter


Type

Values

Description

Context: { } JS Object  

Contains execution context data.

  triggerEvent String

InitialLoad

Everytime

SaveSubmit

Triggering event for the rules in Quote Studio.

Return

Parameter Type Required Value Description

rulesToRun: [ ]

(Holds the ZRule Ids)

Array Required Empty All the rules will be executed.

Filled

Specified list of ZRule Ids will be executed.

runRules:  false

Boolean Optional True Rules would be executed.
False Rules would be skipped. 
forceExecuteRules Boolean Optional 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 Optional True Custom action plugin will execute including remove rate plans.
False Custom action plugin will execute excluding remove rate plans.

If runRules is not provided in the return statement, the default value is true, and the rules engine will be 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 will be added to the inactive list.

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

Custom Fields

ProductRatePlan 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

ProductRatePlan and ProductRatePlanCharge records can be accessed in a custom action plugin.

ProductRatePlan and ProductRatePlanCharge custom fields can be accessed in a custom action plugin when the custom fields are added to the following fieldsets.

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

afterRulesExecution

This hook will trigger 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 will trigger after making any update on the quote field and executing after the Quote update logic.

This hook will be 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.