Documentation Index

Fetch the complete documentation index at: https://docs.zilliant.com/llms.txt

Use this file to discover all available pages before exploring further.

Parameters, fields, and expressions for proposal templates

Prev Next

Use this referential topic when you need the exact names and syntax to pull data from Zilliant CPQ into your report templates. It covers the runtime parameters and fields for PDF templates, the utility methods available in both PDF and Excel templates, and ready-to-copy expressions for images, thumbnails, and common data.

In this topic, learn:


Parameters and fields for PDF templates

Tip

Use the Groovy Additional Data for Proposal Generation extension point to pass additional data in reports.

The following table includes parameters and fields you can use in your PDF or Excel report template to dynamically pass values from CPQ to the report.

Method name

Data type

Usage

Quote (parameter)

com.imc.datamodel.transferobjects.BusinessObjectDTO

Quote header information.

SalesItem (field)

com.imc.datamodel.transferobjects.BusinessObjectDTO

Line item information.

CMIS (parameter)

java.lang.String

Base content path. Use it to build image URLs.

REPORT_LOCALE (parameter)

java.util.Locale

Report locale. Defines number and date formats.

REPORT_RESOURCE_BUNDLE (parameter)

java.util.ResourceBundle

Resource bundle bonded with the report.

currentDate (parameter)

java.lang.String

Today’s date in the DD_MM_YYYY format.

VAR_LOGGED_IN_USER (parameter)

java.lang.String

Username of the signed-in user.

VAR_LOGGED_IN_USER_ROLE (parameter)

java.lang.String

Role of the signed-in user.

SUBREPORT_<name>, where <name> is a subreport name (parameter)

net.sf.jasperreports.engine.JasperReport

Available only when you include a subreport.

To access these parameters also in subreports, pass the REPORT_PARAMETERS_MAP from the main report to the subreport:

<subreport>
<reportElement x="6" y="11" width="545" height="200" uuid="190d17f1-ced8-4d82-a340-32c58ed18fff"/>
<parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{SalesItem}.getAttributeValues("includesPriceItem"))]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_quotePriceItems}]]></subreportExpression>
<subreport>

Expressions to add images to PDF and Excel templates

CPQ allows you to add images that are stored in the system.

  • For PDF reports, the system supports dynamic image generation.

  • For XLSX reports, the system supports static images only.

Use the following expressions to add images to the template:

  • Fixed image—$P{CMIS} + "/logos/losgo.png"

  • Line item image—$P{CMIS} + "/" + $F{SalesItem}.getAttributeValues("salesItemImage").get(0)

  • Product image—$P{CMIS} + "/" + $F{SalesItem}.getAttributeValues("isProduct", "productImage").get(0)


Expression to add product attribute range thumbnails to PDF templates

In addition to the main product image in the proposal PDF, you can also include thumbnails of all product attribute images for that specific quote or agreement. This feature enhances the proposal by giving customers richer visual content.

To add attribute range thumbnails, use the following expression:

<imageExpression><![CDATA[$P{CMIS_ROOT} + "/" + $F{SalesItem}.getDSAValueThumbnails("Demo_Product_Country").get(0)]]></imageExpression>
</image>
<image>
    <reportElement x="160" y="45" width="25" height="20"/>
    <imageExpression><![CDATA[$P{CMIS_ROOT} + "/" + $F{SalesItem}.getDSAValueThumbnails("Demo_Product_Color").get(0)]]></imageExpression>
</image>

Utility methods to get information for PDF and Excel reports

Both PDF and Excel templates can call utility methods to retrieve quote or agreement and line item information. The following table lists all methods, return types, and supported report formats. All method names are case-sensitive.

Method

Details

Supported report format

getAttribute(String fragment)

Accept a single fragment as a parameter. Useful for getting attribute information such as l10nKey.

PDF and Excel

getAttributeLongValue(final String fragment) (Deprecated.)

Accept a single fragment as parameter. Useful for getting a long description of an attribute.

PDF and Excel

getAttributeValue(final BusinessAttribute...businessAttributes)

Accept one or more business attributes as parameters and return a single value. If more than one level, use BusinessRelationAttribute followed by BusinessDataAttribute.

PDF

getAttributeValue(final String...fragments)

Accept one or more fragments as parameter and return a single value. If more than one level, use BusinessRelationAttribute followed by BusinessDataAttribute.

PDF and Excel

getAttributeValues(final BusinessAttribute...businessAttrbutes)

Accept one or more business attributes as parameter and return a list. If more than one level, use BusinessRelationAttribute followed by BusinessDataAttribute.

PDF

getAttributeValues(final String...fragments)

Accept one or more fragments as parameter and return a list. If more than one depth, use BusinessRelationAttribute followed by BusinessDataAttribute.

PDF and Excel

getDALabel(String dynamicAttributeName)

Accept dynamic attribute name as parameter and return label(l10nkey) of dynamic attribute.

PDF and Excel

getDAValues(String dynamicAttributeName)

Accept dynamic attribute name as parameter and return dynamic attribute’s configuration values as list. For DDA, its current value is returned. However, for DSA, a localized text of the value has precedence over its name. If the label exists for DSA value, then it is returned. Otherwise, DSA object name is returned.

PDF and Excel

getDAValue(String dynamicAttributeName)

Similar to getDAValues, only a single value is returned.

PDF and Excel

getDSAValueNames(String dynamicAttributeName)

Accept dynamic attribute name as parameter and return dynamic attribute’s configuration values’ name as a list.

PDF and Excel

getDSAValueName(String dynamicAttributeName)

Similar to getDSAValueNames, only a single value is returned.

PDF and Excel


Expression examples for PDF and Excel reports

The following table provides side-by-side snippets for IDs, names, localization, dates, conditions, and loops so you can port logic between Jasper $P{}, $F{}, $R{}) and JXLS ${…}).

PDF

Excel

Syntax

$P{Quote}.getAttributeValue("quoteId")

${Quote.getAttributeValue("quoteId")}

Syntax

$F{SalesItem}.getAttributeValue("isProduct","objectName")

${SalesItem.getAttributeValue("isProduct","objectName")}

Dynamic Text

((BusinessObjectDTO)$P{Quote}.getAttributeValue("hasIncoTerms")).l10nKey

((BusinessObjectDTO)$P{Quote}.getAttributeValue("hasIncoTerms")).l10nKey

Static Text

$R{table.label.description}

${REPORT_RESOURCE_BUNDLE.getString("table.label.description")}

Date

new SimpleDateFormat("dd.MM.yyyy").format(new java.util.Date())

new SimpleDateFormat("dd.MM.yyyy").format(new java.util.Date())

Condition

Either with the use of printWhenExpression or ternary operator(?).

<jx:if test="${!(attr.attribute.getId().getFragment().matches("has"))}"> </jx:if>

Iteration

Line items iteration is automatically done in the Detail section. If a user wants to make iteration in the section other than Detail, then they can use List Component. Furthermore, if a user wants to print configuration details, they can use that list component and iterate all configurations.

<jx:forEach items="${SalesItem}" var="salesItem"> </jx:forEach>

Import class

Allowed

Not allowed

Declare variables

Allowed

Not allowed except for variables used in iteration

Dynamic image

Supported. For details, read Expressions to add images to PDF and Excel templates.

Not supported