Header Type Value in CLIC Documents with the Default Type

Every CLIC document stores the header type it was created with, such as the Quote Type of a Quote. For most header types, the document stores the type's uniqueName. The default header type is the exception: the document stores the type's label, or null when the type has no label.

Overview

You need this value when a logic reads the header type of a document. You also need it to filter documents by header type. A logic that looks for the value __DEFAULT__ finds no documents.

Stored Value

Header type of the document

Stored value

Default type (__DEFAULT__) without a label

null

Default type (__DEFAULT__) with a label

The label of the default type

Any other header type

The uniqueName of the header type

The uniqueName of the default header type is always __DEFAULT__, and you cannot change it. You can change its label at any time.

In the user interface, documents of the default type show the label, or (Default) when the type has no label.

Field Names

CLIC document

Header type

Field in the document

Field for filters in api.find()

Quote

Quote Type (QTT)

quoteType

quoteTypeUniqueName

Agreement & Promotion

Agreements & Promotions Type (CTHT)

contractHeaderType

contractHeaderTypeUN

Rebate Agreement

Rebate Agreement Type (HRT)

headerRebateType

headerRebateTypeUniqueName

Compensation Plan

Compensation Header Type (COHT)

compensationHeaderType

compensationHeaderTypeUN

Rebate Records and Rebate Record Groups store the Rebate Agreement Type in headerRebateType. Compensation Records store the Compensation Header Type in compensationHeaderType. The same rule applies to these objects.

When the Label Changes

When you change the label of the default header type, Pricefx updates the stored value on all existing documents of that type. This applies to Quotes, Agreements & Promotions, Rebate Agreements and Compensation Plans.

Change to the default type

Stored value on existing documents

You add a label

Changes from null to the new label

You change the label

Changes from the old label to the new label

You remove the label

Changes from the old label to null

Read the Header Type in a Logic

A header type label cannot be the same as the name of another header type. So a lookup by uniqueName returns no result for documents of the default type. Use the default type as the fallback:

Groovy
def headerTypeValue = quoteProcessor.getQuoteView().quoteType

def quoteType = headerTypeValue != null
        ? api.find("QTT", 0, 1, null, Filter.equal("uniqueName", headerTypeValue))?.find()
        : null

if (quoteType == null) {
    // The document uses the default Quote Type
    quoteType = api.find("QTT", 0, 1, null, Filter.equal("uniqueName", "__DEFAULT__"))?.find()
}

def qttAttr1 = quoteType?.attribute1

Find Documents of the Default Type

Filter on the label of the default type. When the default type has no label, filter on null:

Groovy
// The default Quote Type has no label
def defaultTypeQuotes = api.find("Q", 0, 0, null, Filter.isNull("quoteTypeUniqueName"))

// The default Quote Type has the label "Direct Quote"
def directQuotes = api.find("Q", 0, 0, null, Filter.equal("quoteTypeUniqueName", "Direct Quote"))

If the label of the default type can change, read the current label from the header type first. Do not hard-code it.