Pricefx Interceptor API
    Preparing search index...

    Type Alias ClicInterceptorAPI

    This is API for working with Quotes, Contracts, Rebate Agreements and Compensation Plans. It works with lists and details of these entities.

    Name of this API will vary based on the module where you are using it. For quotes it will be:

    export const quotesDetailAccountAssign = ({ quoteAPI }) => {
    // code
    }
    • Compensation Plans: compensationPlanAPI
    • Contracts: contractAPI
    • Rebate Agreements: rebateAgreementAPI
    • Quotes: quoteAPI

    If you use the interceptor methods quotesDetailCreateNewRevision, quotesDetailCopy and the same alternatives for Contracts, Rebate Agreements and Compensation Plans, you will get this API under the names quoteOriginAPI, quoteNewRevisionAPI or quoteCopyAPI (similar pattern for others).

    All these variables contains an object which implement this ClicInterceptorAPI type.

    type ClicInterceptorAPI = {
        addFolder: (name: string, params?: { parent?: string }) => Promise<any>;
        addHeaderInput: (input: Input) => Promise<any>;
        addLineItems: (lineItemIds: string[]) => Promise<any>;
        deleteAllLineItems: () => Promise<any>;
        deleteLineItems: (lineItemsIds: string[]) => Promise<any>;
        disableHeaderInputs: (inputNames: string | string[]) => any;
        getHeaderInput: (inputName: string) => Promise<ClicInput>;
        getHeaderInputValue: (inputName: string) => Promise<any>;
        getHeaderOutput: (outputName: string) => Promise<Output | undefined>;
        getHeaderOutputResult: (outputName: string) => Promise<any>;
        getHeaderType: () => string;
        getHeaderValue: (name: string) => Promise<any>;
        getLineItemInput: (
            queryData: QueryData,
            name: string,
        ) => Promise<ClicInput>;
        getLineItemInputValue: (queryData: QueryData, name: string) => Promise<any>;
        getLineItemOutput: (
            queryData: QueryData,
            resultName: string,
        ) => Promise<Output>;
        getLineItemOutputResult: (
            queryData: QueryData,
            outputName: string,
        ) => Promise<Output>;
        getLineItems: (queryData: QueryData) => Promise<LineItem[]>;
        getLineItemsInPage: (
            queryData: QueryData,
            limit: number,
        ) => Promise<LineItemPage>;
        moveLineItems: (lineItemsIds: string[], folderId: string) => Promise<any>;
        recalculate: (forceAsync?: boolean) => Promise<any>;
        setDisabledButtons: (buttons: string | string[]) => any;
        setHeaderInputValue: (inputName: string, value: any) => Promise<any>;
        setHeaderOutputResult: (outputName: string, value: any) => Promise<any>;
        setHeaderValue: (name: string, value: any) => Promise<any>;
        setLineItemInputValue: (
            queryData: QueryData,
            name: string,
            value: any,
        ) => Promise<any>;
        setLineItemInputValues: (
            queryData: QueryData,
            inputsToAdd: { [inputName: string]: any },
        ) => Promise<any>;
        setReadOnly: (readOnly: boolean) => Promise<any>;
        updateHeader: (
            values: { [headerFieldName: string]: any },
            inputValues: { [headerInputName: string]: any },
        ) => any;
    }
    Index

    Properties

    addFolder: (name: string, params?: { parent?: string }) => Promise<any>

    Creates folder in line items tab in CLIC module.

    Type declaration

      • (name: string, params?: { parent?: string }): Promise<any>
      • Parameters

        • name: string

          The name of the folder to be added.

        • Optionalparams: { parent?: string }

          An options object containing additional properties for the folder.

          • Optionalparent?: string

            The ID of the parent folder.

        Returns Promise<any>

    export const quotesDetailOpen = async ({ quoteAPI }) => {
    await quoteAPI.addFolder('My Folder');
    }
    export const quotesDetailOpen = async ({ quoteAPI }) => {
    const folder = await quoteAPI.addFolder("First Folder");
    await quoteAPI.addFolder('My Folder', {parent: folder});
    }
    addHeaderInput: (input: Input) => Promise<any>

    Adds an input to the CLIC header.

    Type declaration

      • (input: Input): Promise<any>
      • Parameters

        • input: Input

          The object of the input.

        Returns Promise<any>

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

    Create line Item in line items tab in CLIC module. Multiple line items with same sku can be created.

    export const quotesDetailNew = async ({ quoteAPI }) => {
    await quoteAPI.addLineItems(["sku1", "sku1", "sku2"]);
    }
    deleteAllLineItems: () => Promise<any>

    Deletes all line items from CLIC object.

    export const quotesDetailOpen = async ({ quoteAPI }) => {
    await quoteAPI.addLineItems(['B-0011', 'B-0011', 'B-0001']);
    const response = await quoteAPI.deleteAllLineItems();
    console.log(response); // 3
    };
    deleteLineItems: (lineItemsIds: string[]) => Promise<any>

    Deletes line items from CLIC object. Please note that this method takes an array of line IDs as argument, since SKU is not unique. In order to properly delete line items, use "getLineItems" method and then use "lineId" field that is fetched from it.

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

    Disables inputs at the CLIC header.

    CLIC Detail Only - In a list, this method does not make sense, so it is implemented just as an empty method there.

    export const quotesDetailOpen = async ({ quoteAPI }) => {
    await quoteAPI.disableHeaderInputs('Customer'); // or ['Customer', ...]
    }
    getHeaderInput: (inputName: string) => Promise<ClicInput>

    Gets an input by inputName from the CLIC header.

    You can use dots to create a path to a nested input. For example if you have the input stringUserEntry1_collapsible_row1 inside row1 input, and it is inside collapsibleSectionWithRow input then the path will look like collapsibleSectionWithRow.row1.stringUserEntry1_collapsible_row1.

    Type declaration

      • (inputName: string): Promise<ClicInput>
      • Parameters

        • inputName: string

          The name of the input. You can use dots to create a path to a nested input. E.g. collapsibleSectionWithRow.row1.stringUserEntry1_collapsible_row1

        Returns Promise<ClicInput>

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

    Returns an input value from the CLIC header.

    Type declaration

      • (inputName: string): Promise<any>
      • Parameters

        • inputName: string

          The name of the input. You can use dots to create a path to a nested input. E.g. collapsibleSectionWithRow.row1.stringUserEntry1_collapsible_row1

        Returns Promise<any>

    export const quotesDetailOpen = async ({ quoteAPI }) => {
    const clicInputValue = await quoteAPI.getHeaderInputValue('Customer');
    console.log(clicInputValue); // 'CD-0001'
    }
    getHeaderOutput: (outputName: string) => Promise<Output | undefined>

    Gets an output by outputName from the CLIC header.

    Type declaration

      • (outputName: string): Promise<Output | undefined>
      • Parameters

        • outputName: string

          The name of the output.

        Returns Promise<Output | undefined>

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

    Returns an output result from the CLIC header.

    Type declaration

      • (outputName: string): Promise<any>
      • Parameters

        • outputName: string

          The name of the output.

        Returns Promise<any>

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

    Retrieves CLIC header type

    export const quotesDetailOpen = async ({ quoteAPI }) => {
    const headerType = await quoteAPI.getHeaderType(); // 'Default_quote_type'
    }
    getHeaderValue: (name: string) => Promise<any>

    Gets a value from the CLIC header. Use it to obtain properties such as version, externalRef, calculationStatus, etc.

    Type declaration

      • (name: string): Promise<any>
      • Parameters

        • name: string

          The name of the property which you want obtain.

        Returns Promise<any>

    export const quotesDetailOpen = async ({ quoteAPI }) => {
    const quoteStatus = await quoteAPI.getHeaderValue('quoteStatus');
    console.log(quoteStatus) // 'DRAFT'
    }
    getLineItemInput: (queryData: QueryData, name: string) => Promise<ClicInput>

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

    Type declaration

      • (queryData: QueryData, name: string): Promise<ClicInput>
      • Parameters

        • queryData: QueryData
        • name: string

          The name of input

        Returns Promise<ClicInput>

    getLineItemInputValue: (queryData: QueryData, name: string) => Promise<any>

    Returns a value from the input defined by name from a line item which is the first in the response defined by queryData.

    Type declaration

      • (queryData: QueryData, name: string): Promise<any>
      • Parameters

        • queryData: QueryData
        • name: string

          The name of the input.

        Returns Promise<any>

    getLineItemOutput: (queryData: QueryData, resultName: string) => Promise<Output>

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

    Type declaration

      • (queryData: QueryData, resultName: string): Promise<Output>
      • Parameters

        • queryData: QueryData
        • resultName: string

          The name of the output.

        Returns Promise<Output>

    getLineItemOutputResult: (
        queryData: QueryData,
        outputName: string,
    ) => Promise<Output>

    Returns a result from the output defined by outputName from a line item which is the first in the response defined by queryData.

    Type declaration

      • (queryData: QueryData, outputName: string): Promise<Output>
      • Parameters

        • queryData: QueryData
        • outputName: string

          The name of the output.

        Returns Promise<Output>

    getLineItems: (queryData: QueryData) => Promise<LineItem[]>

    Fetches items from CLIC by queryData.

    getLineItemsInPage: (
        queryData: QueryData,
        limit: number,
    ) => Promise<LineItemPage>

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

    moveLineItems: (lineItemsIds: string[], folderId: string) => Promise<any>

    Move line item to the folder.

    Type declaration

      • (lineItemsIds: string[], folderId: string): Promise<any>
      • Parameters

        • lineItemsIds: string[]

          of the items which should be moved.

        • folderId: string

          to which line items will be added. export const quotesDetailNew = async ({ quoteAPI }) => { const items = await quoteAPI.addLineItems(["arch", "mint", "ubuntu"]); const folder = await quoteAPI.addFolder('Linux folder'); await quoteAPI.moveLineItems(items, folder); }

        Returns Promise<any>

    recalculate: (forceAsync?: boolean) => Promise<any>

    Triggers a recalculation at the CLIC object.
    By default, it is decided if the recalculation is triggered as async by Async actions threshold, which is defined in Administration > Configuration >…. You can force the trigger as async by passing true to the forceAsync parameter.

    Type declaration

      • (forceAsync?: boolean): Promise<any>
      • Parameters

        • OptionalforceAsync: boolean

          The recalculation will we triggered as an async job.

        Returns Promise<any>

    setDisabledButtons: (buttons: string | string[]) => any

    Disables CLIC detail buttons in the header/items tabs. The options are:

    • Header tab: submit, calculate, startCreationWorkflow, nextStepCreationWorkflow, backStepCreationWorkflow, finishCreationWorkflow, finishCreationWorkflowAndSubmit, withdraw, markOfferAsLost, convertToDeal, reconvertToDeal, revoke, createNewRevision, emailing, emailingAndSignature, createOpportunity, assignOpportunity, assignAccount, duplicate, remove.

    • Items tab:

      • Header action buttons: add_items, browse_items, add_recommended_items, addFolder, massEdit, copyAllItemsToClipboard, importItemsToClipboard.

      • Selection context buttons: deleteItems, duplicateItems, moveItemsToFolder.

    CLIC Detail Only - In a list, this method does not make sense, so it is implemented just as an empty method there.

    export const quotesDetailOpen = async ({ quoteAPI }) => {
    // When a user opens a Quote, it has disabled buttons Recalculate, Duplicate and Assign Account
    await quoteAPI.setDisabledButtons(['calculate', 'assignAccount', 'duplicate']);
    }
    setHeaderInputValue: (inputName: string, value: any) => Promise<any>

    Sets an input value at the CLIC header.

    Type declaration

      • (inputName: string, value: any): Promise<any>
      • Parameters

        • inputName: string

          The name of the input. You can use dots to create a path to a nested input. E.g. collapsibleSectionWithRow.row1.stringUserEntry1_collapsible_row1

        • value: any

        Returns Promise<any>

    export const quotesDetailOpen = async ({ quoteAPI }) => {
    // Simple inputs
    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: (outputName: string, value: any) => Promise<any>

    Sets an output result at the CLIC header.

    Type declaration

      • (outputName: string, value: any): Promise<any>
      • Parameters

        • outputName: string

          The name of the output.

        • value: any

          The result value of the output.

        Returns Promise<any>

    export const quotesDetailOpen = async ({ quoteAPI }) => {
    const clicOutputResult = await quoteAPI.setHeaderOutputResult('outputName', 'Test value');
    }
    setHeaderValue: (name: string, value: any) => Promise<any>

    Updates a field at the CLIC header. Use it to update properties such as expiryDate, externalRef, additionalInfo1, etc

    Type declaration

      • (name: string, value: any): Promise<any>
      • Parameters

        • name: string

          The name of field at the CLIC header.

        • value: any

          The value of the field which will be set.

        Returns Promise<any>

    export const quotesDetailNew = async ({ quoteAPI }) => {
    await quoteAPI.setHeaderValue('label', 'Updated label from intercepted method');
    }
    setLineItemInputValue: (
        queryData: QueryData,
        name: string,
        value: any,
    ) => Promise<any>

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

    Type declaration

      • (queryData: QueryData, name: string, value: any): Promise<any>
      • Parameters

        • queryData: QueryData
        • name: string

          The name of the input.

        • value: any

          The value of the input.

        Returns Promise<any>

    setLineItemInputValues: (
        queryData: QueryData,
        inputsToAdd: { [inputName: string]: any },
    ) => Promise<any>

    Updates multiple line item inputs values at once.

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

    Sets the CLIC object as read-only in UI.

    CLIC Detail Only - In a list, this method does not make sense, so it is implemented just as an empty method there.

    export const quotesDetailOpen = async ({ quoteAPI }) => {
    await quoteAPI.setReadOnly(true);
    }
    updateHeader: (
        values: { [headerFieldName: string]: any },
        inputValues: { [headerInputName: string]: any },
    ) => any

    Updates header values and header input values.

    Type declaration

      • (
            values: { [headerFieldName: string]: any },
            inputValues: { [headerInputName: string]: any },
        ): any
      • Parameters

        • values: { [headerFieldName: string]: any }

          object containing header value names as keys and corresponding values

        • inputValues: { [headerInputName: string]: any }

          object containing header input value names as keys and corresponding values

        Returns any

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