CLIC Method Interceptor API

CLIC Method Interceptor API

Overview

This API is designed for working with Quotes, Contracts, Rebate Agreements, and Compensation Plans. It provides functionality for both list and detail views of these entities.

API Naming Convention

The API name varies based on the module where it's used:

  • Quotes: quoteAPI

  • Compensation Plans: compensationPlanAPI

  • Contracts: contractAPI

  • Rebate Agreements: rebateAgreementAPI

Usage Example

export const quotesDetailAccountAssign = ({ quoteAPI }) => { // code }

Special Cases

For specific interceptor methods, the API names are:

  • quotesDetailCreateNewRevision: quoteNewRevisionAPI

  • quotesDetailCopy: quoteCopyAPI

  • Origin API: quoteOriginAPI

Similar patterns apply for Contracts, Rebate Agreements, and Compensation Plans.

API Methods

addFolder

Creates folder in line items tab in CLIC module.

Parameters:

  • name (required): String - The name of the folder to be added.

  • params: {
        parent?: string;
    }

    An options object containing additional properties for the folder.

    • parent?: string

      The ID of the parent folder.

Example:

export const quotesDetailOpen = async ({ quoteAPI }) => { const folder = await quoteAPI.addFolder("First Folder"); // folder contains id of folder await quoteAPI.addFolder('My Folder', {parent: folder}); }

addHeaderInput

Adds an input to the CLIC header.

Parameters:

  • input: Object - The input object to be added

addLineItems

addLineItems: ((string[]) => Promise<string[]>)

Adds line items to the CLIC object.

Parameters:

  • lineItemIds: string[] - Array of line item IDs

deleteLineItems

deleteLineItems: ((string[]) => Promise<string[]>)

Deletes line items from the CLIC object.

Parameters:

  • lineItemsIds: string[] - Array of line item IDs

Example:

export const quotesDetailOpen = async ({ quoteAPI }) => { const lineItems = await quoteAPI.getLineItems(); const response = await quoteAPI.deleteLineItems([lineItems[0].lineId]); console.log({ response }); // 1 };

disableHeaderInputs

Disables inputs at the CLIC header. (CLIC Detail Only)

Parameters:

  • inputNames: string | string[] - Name(s) of input(s) to disable

Example:

export const quotesDetailOpen = async ({ quoteAPI }) => { await quoteAPI.disableHeaderInputs('Customer'); // or ['Customer', ...] }

getHeaderInput

Gets an input by inputName from the CLIC header.

Parameters:

  • inputName: string - The name of the input

Example:

export const quotesDetailOpen = async ({ quoteAPI }) => { const clicInput = await quoteAPI.getHeaderInput('Customer'); console.log(clicInput); // {"name": "Customer", "label": "Customer", "value": "CD-0001", ...} }

getHeaderInputValue

Returns an input value from the CLIC header.

Parameters:

  • inputName: string - The name of the input

Example:

export const quotesDetailOpen = async ({ quoteAPI }) => { const clicInputValue = await quoteAPI.getHeaderInputValue('Customer'); console.log(clicInputValue); // 'CD-0001' }

getHeaderOutput

Gets an output by outputName from the CLIC header.

Parameters:

  • outputName: string - The name of the output

Example:

export const quotesDetailOpen = async ({ quoteAPI }) => { const clicOutput = await quoteAPI.getHeaderOutput('totalAmount'); console.log(clicOutput); // {"resultName": "totalAmount", "resultLabel": "totalAmount", "result": 123456789.12345679, ...} }

getHeaderOutputResult

Returns an output result from the CLIC header.

Parameters:

  • outputName: string - The name of the output

Example:

export const quotesDetailOpen = async ({ quoteAPI }) => { const clicOutputResult = await quoteAPI.getHeaderOutputResult('totalAmount'); console.log(clicOutputResult); // 123456789.12345679 }

getHeaderType

Retrieves CLIC header type.

Example:

export const quotesDetailOpen = async ({ quoteAPI }) => { const headerType = await quoteAPI.getHeaderType(); // 'Default_quote_type' }

getHeaderValue

Gets a value from the CLIC header.

Parameters:

  • name: string - The name of the property to obtain

Example:

export const quotesDetailOpen = async ({ quoteAPI }) => { const quoteStatus = await quoteAPI.getHeaderValue('quoteStatus'); console.log(quoteStatus) // 'DRAFT' }

getLineItemInput

Returns an input by name from the first line item fetched by queryData.

Parameters:

  • queryData: QueryData

  • name: string - The name of the input

getLineItemInputValue

Returns a value from the input defined by name from a line item.

Parameters:

  • queryData: QueryData

  • name: string - The name of the input

getLineItemOutput

Returns an output by resultName from the first line item fetched by queryData.

Parameters:

  • queryData: QueryData

  • resultName: string - The name of the output

getLineItemOutputResult

Returns a result from the output defined by outputName from a line item.

Parameters:

  • queryData: QueryData

  • outputName: string - The name of the output

getLineItems

getLineItems: (() => Promise<string[]>)

Fetches items from CLIC by queryData.

Parameters:

  • queryData: QueryData

getLineItemsInPage

Fetches items as a page from CLIC by queryData and limit.

Parameters:

  • queryData: QueryData

  • limit: number

recalculate

recalculate: (() => Promise<void>)

Triggers a recalculation at the CLIC object.

Parameters:

  • forceAsync: boolean (optional) - Force the recalculation as an async job

setDisabledButtons

Disables CLIC detail buttons in the header/items tabs. (CLIC Detail Only)

Parameters:

  • buttons: string | string[] - Button(s) to disable

Example:

export const quotesDetailOpen = async ({ quoteAPI }) => { await quoteAPI.setDisabledButtons(['calculate', 'assignAccount', 'duplicate']); }

setHeaderInputValue

Sets an input value at the CLIC header.

Parameters:

  • inputName: string - The name of the input

  • value: any - The value to set

Example:

export const quotesDetailOpen = async ({ quoteAPI }) => { await quoteAPI.setHeaderInputValue('ProjectID', 'Some ID'); await quoteAPI.setHeaderInputValue('ProjectName', 'Project Name'); // Input with configurator await quoteAPI.setHeaderInputValue('Configurator_Documents', { InvoiceMethod: 'Invoice method', OpportunityOwner: 'Name', OpportunityOwnerEmail: 'Email', OpportunityOwnerPhone: 'Phone', OpportunityOwnerTitle: 'Title' }); }

setHeaderOutputResult

Sets an output result at the CLIC header.

Parameters:

  • outputName: string - The name of the output

  • value: any - The result value of the output

Example:

export const quotesDetailOpen = async ({ quoteAPI }) => { const clicOutputResult = await quoteAPI.setHeaderOutputResult('outputName', 'Test value'); }

setHeaderValue

Updates a field at the CLIC header.

Parameters:

  • name: string - The name of field at the CLIC header

  • value: any - The value of the field to be set

Example:

export const quotesDetailNew = async ({ quoteAPI }) => { await quoteAPI.setHeaderValue('label', 'Updated label from intercepted method'); }

setLineItemInputValue

Sets a value of the input with a name which is at the first line item defined by queryData.

Parameters:

  • queryData: QueryData

  • name: string - The name of the input

  • value: any - The value of the input

setLineItemInputValues

Updates multiple line item inputs values at once.

Parameters:

  • queryData: QueryData

  • inputsToAdd: Object - Key-value pairs of input names and their values

Example:

export const quotesDetailOpen = async ({ quoteAPI }) => { await quoteAPI.setLineItemInputValues('product-1', {Quantity: 3, Customer: 'CD-0001'}); }

setReadOnly

Sets the CLIC object as read-only in UI. (CLIC Detail Only)

Parameters:

  • readOnly: boolean

Example:

export const quotesDetailOpen = async ({ quoteAPI }) => { await quoteAPI.setReadOnly(true); }

updateHeader

Updates header values and header input values.

Parameters:

  • values: Object - Key-value pairs of header field names and their values

  • inputValues: Object - Key-value pairs of header input names and their values

Example:

export const quotesDetailOpen = async ({ quoteAPI }) => { await quoteAPI.updateHeader({externalRef: 'new external ref', label: 'new label'}, {Customer: 'CD-0001'}); }

Notes

  • Some methods are only applicable in CLIC Detail view and not in list view.

  • When using dot notation for nested inputs (e.g., collapsibleSectionWithRow.row1.stringUserEntry1_collapsible_row1), ensure the path is correct.

  • Always handle promises returned by these methods appropriately in your code.