Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The following table provides a list of available methods for creating user inputs. There are two ways of creating inputs – the previous way using InputType and the recommended Input Builder approach. See the InputBuilderFactory Groovy API documentation for details on all available Input Builders.

Name of the Input Builder method and Link to API Docs

InputType

Code Example

Deprecated Groovy API method (for creating inputs)

createAnyUser()

USER

Use this method to select a user. Returns the user's login name (not the full user object).

Code Block
languagegroovy
     if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createAnyUserEntry("AnyUser")
             .setLabel("AnyUser")
             .getInput()
 } else {
     input.AnyUser
 }


anyUser()

createbooleanUserEntry()

BOOLEANUSERENTRY


Code Block
languagegroovy
     if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createBooleanUserEntry("Boolean")
             .setLabel("Boolean")
             .getInput()
 } else {
     input.Boolean
 }


booleanUserEntry()

createConfiguratorInputBuilder()

CONFIGURATOR

INLINECONFIGURATOR


Code Block
languagegroovy
     if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createConfiguratorInputBuilder("form", "ConfiguratorLogic", false)
             .setLabel("Configurator")
             .getInput()
 } else {
     input.form
 }


configurator()

createButtonEntry()

BUTTON


Code Block
languagegroovy
 def ce = api.createConfiguratorEntry()
 def button = api.inputBuilderFactory()
         .createButtonEntry("button")
         .setLabel("Button")
         .setTargetPage(AppPages.MD_PRODUCTS_PAGE)
         .buildContextParameter()

 return ce.createParameter(builder)


not available

createCollapseLayout()

COLLAPSE


Code Block
languagegroovy
 def ce = api.createConfiguratorEntry()

 def input1 = api.inputBuilderFactory()
               .createUserEntry("Input1")
               .setValue("23")
               .setLabel("Input1")
               .buildContextParameter()

 def input2 = api.inputBuilderFactory()
               .createUserEntry("Input2")
               .setValue("24")
               .setLabel("Input2")
               .buildContextParameter()

 def inputRow = api.inputBuilderFactory()
                 .createCollapseLayout("Collapsible Section")
                 .setCollapsed(false)
                 .addInput(input1)
                 .addInput(input2)
                 .addToConfiguratorEntry(ce)

 return ce


not available

createConfiguratorTable()

CONFIGURATORTABLE


Code Block
languagegroovy
 def columns = [
     [name: 'Date', label: 'Date', type: 'DATE'],
     [name: 'Datetime', label: 'Datetime', type: 'DATETIME'],
     [name: 'Integer', label: 'Integer', type: 'INTEGER'],
     [name: 'Link', label: 'Link', type: 'LINK'],
     [name: 'Money', label: 'Money', type: 'MONEY'],
     [name: 'MoneyEUR', label: 'Money EUR', type: 'MONEY_EUR'],
     [name: 'Numeric', label: 'Numeric', type: 'NUMERIC'],
     [name: 'NumericLong', label: 'Numeric Long', type: 'NUMERIC_LONG'],
     [name: 'Percent', label: 'Percent', type: 'PERCENT'],
     [name: 'String', label: 'String', type: 'TEXT'],
     [name: 'Product', label: 'Product', type: 'TEXT'],
     [name: 'Customer', label: 'Customer', type: 'TEXT'],
 ]

 def rowTypes = [
     [label: "Add Product Row", url: "configuratorTableTest_ProductConfigurator"],
     [label: "Add Customer Row", url: "configuratorTableTest_CustomerConfigurator"],
 ]

 def ct = api.inputBuilderFactory()
     .createConfiguratorTable("ConfiguratorTableName")
     .setColumns(columns)
     .setDimensions("300", "800")
     .withEnableClientFilter(false)
     .withEnableEditActions(true)
     .withEnableDuplicateActions(true)
     .withEnableDeleteActions(false)
     .withRowTypes(rowTypes)
     .setDefaultHeight(500)
     .setFixTableHeight(true)
     .setLabel("Configurator Table Label")
     .buildContextParameter()

 def ce = api.createConfiguratorEntry()

 ce.createParameter(ct)

 return ce


not available

createConfiguratorEntry()

Creates an empty configurator entry object. Must be filled with inputs by calling createParameter() on InputBuilderFactory.

Code Block
languagegroovy
 def formSection = api.createConfiguratorEntry()
 def param = api.inputBuilderFactory()
                .createOptionEntry(name)
                .setLabel(label)
                .setOptions(optionValues)
                .buildContextParameter()

 formSection.createParameter(param)
 return formSection
 }



createConfiguratorEntryArray()


Code Block
languagegroovy
def sourceEntries = api.createConfiguratorEntry()
sourceEntries.addAdditionalConfigValue("sectionLabel", "Here to enter a source DM")

api.inputBuilderFactory()
        .createDMSource("source")
        .setLabel("Source DM")
        .setRequired(true)
        .addToConfiguratorEntry(sourceEntries)

def parameterEntry = api.createConfiguratorEntry()
parameterEntry.addAdditionalConfigValue("sectionLabel", "Here another configurator entry")

def param = parameterEntry.createParameter(InputType.USERENTRY, "myParameter")
param.setLabel("My Parameter")
if (param.getValue() == null) {
    param.setValue(42)
}
param.setRequired(false)
param.setConfigParameter("noRefresh", true)

return api.createConfiguratorEntryArray(sourceEntries, parameterEntry)



createCustomerEntry()

CUSTOMER


Code Block
languagegroovy
     if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createCustomerEntry("customer")
             .setLabel("Select a customer")
             .getInput()
 } else {
     input.Customer
 }
 


customer(), otherCustomer()

createCustomerGroupEntry()

CUSTOMERGROUP


Code Block
languagegroovy
     if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createCustomerGroupEntry("CustomerGroup")
             .setLabel("Customer(s)")
             .getInput()
 } else {
     CustomerGroup.fromMap(input.CustomerGroup)
 }


customerGroupEntry()

createCustomFormListPopup()

CUSTOMFORMLISTPOPUP


Code Block
languagegroovy
 if (api.isInputGenerationExecution()) {
      return api.inputBuilderFactory()
              .createCustomFormListPopup("customFormPopup", "123.CFOT")
              .setLabel("Select a Custom Form")
              .withSubsetFilter(Filter.equal("formStatus", "APPROVED"))
              .withRecalculateParentOnPopupConfirm(true)
              .getInput()
  } else {
      input.customFormPopup
  }


not available

createDashboardInputs()

DASHBOARDINPUTS


Code Block
languagegroovy
     def optionalPath = ["embeddedPortlet", "embeddedPortletInsideEmbeddedPortlet"]
     def input = api.inputBuilderFactory()
                    .createDashboardInputs("DB Inputs", "Dashboard_UniqueName", *optionalPath)
                    .setMaximumDepth(1) // optional - maximum recursion levels for embedded Dashboards
                    .getInput()


not available

createDashboardPopup()

DASHBOARDPOPUP


Code Block
languagegroovy
     def input = api.inputBuilderFactory()
                      .createDashboardPopup("Dashboard")
                      .setFilter(Filter.ilike("uniqueName", "<prefix>%"))
                      .getInput()


not available

createDateRangeUserEntry()

DATERANGEUSERENTRY


Code Block
languagegroovy
     if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createDateRangeUserEntry("DateRange")
             .setLabel("Select start date and end date")
             .getInput()
 } else {
     api.parseDate("yyyy-MM-dd", input.DateRange)
 }


dateRangeUserEntry()

createDateTimeUserEntry()

DATETIMEUSERENTRY


Code Block
languagegroovy
     if (api.isInputGenerationExecution()) {
     api.inputBuilderFactory()
             .createDateTimeUserEntry("DateTime")
             .setLabel("Select date and time")
             .getInput()
 } else {
     api.parseDate("yyyy-MM-dd'T'HH:mm:ss", input.DateTime)
 }


dateTimeUserEntry()

createDateUserEntry()

DATEUSERENTRY


Code Block
languagegroovy
 if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createDateUserEntry("Date")
             .setLabel("Select date")
             .getInput()
 } else {
     api.parseDate("yyyy-MM-dd", input.Date)
 }


dateUserEntry()



Code Block
def ctx = api.getDatamartContext()
def dm = ctx.getDatamart("Sales_Data")
def period = dm.getColumn("Country")
 
return ctx.dimFilterEntry("Customer Country", period)


dimFilterEntry()

createDMField()

DMFIELD


Code Block
languagegroovy
 def builder = api.inputBuilderFactory().createDMField("MyInput","DM.datamart_transaction")
                   .setLabel("DM Field")
                   .setFieldTypes(FieldType.NUMBER, FieldType.MONEY) // to select either number or money fields
                   .setFieldKind(FieldKind.DIMENSION, FieldKind.KEY) // AND that are dimension or key
 return libs.InputLib.Input.inputParamBuilder(out, builder)


not available

createDMFields()

DMFIELDS


Code Block
languagegroovy
 def builder = api.inputBuilderFactory().createDMFields("MyInput","DM.datamart_transaction")
                   .setFieldTypes(FieldType.NUMBER, FieldType.MONEY) // to select either number or money fields
                   .setFieldKind(FieldKind.DIMENSION, FieldKind.KEY) // AND that are dimension or key
 return libs.InputLib.Input.inputParamBuilder(out, builder)


not available

createDmFilter()

DMDIMFILTER


Code Block
languagegroovy
 def dm = api.inputBuilderFactory()
         .createDmFilter("Select a product", "DM.datamart_transaction", "ProductID")
         .buildMap()

 quoteProcessor.addOrUpdateInput(dm)



createDmFilterBuilder()

DMFILTERBUILDER


Code Block
 if (api.isInputGenerationExecution()) {
   return api.inputBuilderFactory()
       .createDmFilterBuilder("DataFilter", "datamart_transaction")
       .setLabel("Data Filter")
       .setRequired(false)
       .setNoRefresh(true)
       .getInput()
 }

 return input.DataFilter ? api.filterFromMap(input.DataFilter) : null

return result


datamartFilterBuilderUserEntry()

createDmFilterBuilderMultiple()

DMFILTERBUILDERMULTIPLE


Code Block
languagegroovy
 if (api.isInputGenerationExecution()) {
   return api.inputBuilderFactory()
       .createDmFilterBuilderMultiple("DataFilter", "datamart_transaction")
       .setLabel("Data Filter")
       .setRequired(false)
       .setNoRefresh(true)
       .getInput()
 }

 return input.DataFilter ? api.filterFromMap(input.DataFilter) : null


not available

createDmQueryBuilder()

DMQUERYBUILDER


Code Block
languagegroovy
     def param = api.inputBuilderFactory()
                .createDmQueryBuilder("query")
                .setLabel("Build your query")
                .getInput()


not available

createDmQueryFilterBuilder()

DMQUERYFILTERBUILDER


Code Block
languagegroovy
     def param = api.inputBuilderFactory()
                .createDmQueryBuilder("query")
                .setLabel("Build your query")
                .getInput()
     def param = api.inputBuilderFactory()
                .createDmQueryFilterBuilder("filter", qbState)
                .setLabel("Build your filter")
                .getInput()


not available

createDMSource()

DMSOURCE


Code Block
languagegroovy
 def builder = api.inputBuilderFactory()
         .createDMSource("DMSource")
         .setLabel("Select the Field Collection Source")
         .setTypes("DMDS", "DM")
 return libs.InputLib.Input.inputParamBuilder(out, builder)


not available

createFilterBuilder()

FILTERBUILDER


Code Block
     if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createFilterBuilder("FilterBuilder", "P")
             .setLabel("Set a product filter")
             .getInput()
 } else {
     input.FilterBuilder
 }


filterBuilderUserEntry()

createHiddenEntry()

HIDDEN


Code Block
languagegroovy
 if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createHiddenEntry("hidden")
             .setLabel("Hidden")
             .getInput()
 }

 return input.hidden


not available

createInputMatrix()

INPUTMATRIX

The following code snippet creates an input matrix:

Code Block
languagegroovy
if (api.isInputGenerationExecution()) {
def columns = ["Col 1", "Col 2"]
def columnsValueOption = [
"Col 1": ["Yellow", "Blue"]
]

return api.inputBuilderFactory()
.createInputMatrix("InputMatrix")
.setColumns(columns)
.setColumnValueOptions(columnsValueOption)
.setLabel("InputMatrix")
.getInput()
} else {
input.InputMatrix
}


inputMatrix()

createIntegerUserEntry()

INTEGERUSERENTRY


Code Block
languagegroovy
 if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createIntegerUserEntry("Integer")
             .setLabel("Enter a whole number")
             .setPlaceholderText("23")
             .getInput()
 } else {
     input.Integer
 }


integerUserEntry()

createMultiTierEntryInputBuilder()

MULTITIERENTRY

It renders a list of input tuples – Target & Value.

Example
Code Block
languagegroovy
 import net.pricefx.common.api.chart.TieredValueValidationType
 import net.pricefx.common.api.chart.TieredValueSortType

 if (api.isInputGenerationExecution()) {
     api.inputBuilderFactory()
             .createMultiTierEntryInputBuilder("multiTier")
             .setLabel("Multi Tier")
             .setValue([
                      "10" : "20",
                      "20" : "40"
                 ])
             .setSortType(TieredValueSortType.ASC)
             .setValidationType(TieredValueValidationType.NO_VALIDATION)
             .getInput()
 } else {
     input.multiTier
 }


Returns

  • The result value is a List of TieredValue objects, i.e., you can make certain operations on them.


This code will multiply the values (the 2nd column) with the given number
Code Block
languagegroovy
def tieredVal  = input.multiTier
tieredVal = tieredVal.multiplyValues(0.01)


Conversion of the returned value (List of TieredValue) to Map
Code Block
languagegroovy
input.multiTier?.asMap()

See the TieredValue class documentation.

multiTierEntry()

createOptionEntry()

OPTION


Code Block
languagegroovy
 if (api.isInputGenerationExecution()) {
     def salesOrgs = [
             "yellow": "top",
             "blue": "bottom"
     ]

     return api.inputBuilderFactory()
             .createOptionEntry("Option")
             .setOptions(salesOrgs.keySet() as List)
             .setLabels(salesOrgs)
             .setLabel("Option")
             .getInput()
 } else {
     input.Option
 }


option()

createOptionsEntry()

OPTIONS


Code Block
languagegroovy
 if (api.isInputGenerationExecution()) {
     def salesOrgs = [
             "yellow": "top",
             "blue": "bottom"
     ]

     return api.inputBuilderFactory()
             .createOptionsEntry("Options")
             .setOptions(salesOrgs.keySet() as List)
             .setLabels(salesOrgs)
             .setLabel("Options")
             .getInput()
 } else {
     input.Options
 }


options()

createProductEntry()

PRODUCT


Code Block
languagegroovy
 if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createProductEntry("Product")
             .setLabel("Select a product")
             .getInput()
 } else {
     input.Product
 }


otherProduct

createParsableInputTypeFile()

PARSABLEINPUTFILE

This method creates an input parameter which lets the user pick an XLSX file to be used in a logic. It returns a handle that uniquely identifies the binary and its version that has been assigned to the input.

The parsableInputFileData function opens the input data and parses the file into Groovy data structures.

This methods works only for entities with attachments (i.e. Quotes, Agreements/Promotions, Rebate Agreements). As the upload file is stored in the database and linked there to e.g., a quote, you need to save the quote first to have an instance in the database.

Code Block
languagegroovy
 def builder = api.inputBuilderFactory().createParsableInputTypeFile("File")
 return libs.InputLib.Input.inputParamBuilder(out,builder)


parsableInputFile()

createProductGroupEntry()

PRODUCTGROUP


Code Block
languagegroovy
 if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createProductGroupEntry("ProductGroup")
             .setLabel("Select products")
             .getInput()
 } else {
     ProductGroup.fromMap(input.ProductGroup)
 }


productGroupEntry()

createQuoteType()

QUOTETYPE


Code Block
languagegroovy
 def builder = api.inputBuilderFactory().createQuoteType("New quote")
 return libs.InputLib.Input.inputParamBuilder(out,builder)


not available

createRadioEntry()

RADIO


Code Block
languagegroovy
 def radio = api.inputBuilderFactory()
         .createRadioEntry('radioEntry')
         .setOptions(['Yes', 'No'])
         .setValue('No')
         .setLabel('Yes or no?')

         .buildMap()


not available

createRebateAgreement()

REBATEAGREEMENT


Code Block
languagegroovy
 if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createRebateAgreement("RebateAgreement")
             .setLabel("Select a Rebate Agreement")
             .getInput()
 } else {
     input.RebateAgreement
 }
 


rebateAgreementUserEntry

createResultMatrixFilterBuilder()

RESULTMATRIXFILTER


Code Block
languagegroovy
 def ce = api.createConfiguratorEntry()


 def products = api.find("P", 0, 10, null, ["sku", "label", "currency"])

 def resultMatrix = api.newMatrix().withColumnFormats([
         "sku"     : FieldFormatType.TEXT,
         "label"   : FieldFormatType.TEXT,
         "currency": FieldFormatType.TEXT
 ]).withRows(products);


 def rmFilterBuilder = api.inputBuilderFactory()
         .createResultMatrixFilterBuilder("rMatrixFilter", resultMatrix)
         .setLabel("Result Matrix Filter")
         .buildContextParameter()

 return ce.createParameter(rmFilterBuilder)


not available

createRowLayout()

ROW


Code Block
languagegroovy
 def ce = api.createConfiguratorEntry()

 def input1 = api.inputBuilderFactory()
               .createRebateAgreement("ra")
               .setLabel('Select a Rebate Agreement')
               .buildContextParameter()

 def input2 = api.inputBuilderFactory()
               .createProductEntry("product")
               .setLabel('Select a Product')
               .buildContextParameter()

 def inputRow = api.inputBuilderFactory()
                 .createRowLayout("row")
                 .addInput(input1)
                 .addInput(input2)
                 .addToConfiguratorEntry(ce)

 return ce



createSellerEntry()

SELLER


Code Block
languagegroovy
 if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createSellerEntry("Seller")
             .setLabel("Select a seller")
             .getInput()
 } else {
     input.Seller
 }


seller()

createSellerGroupEntry()

SELLERGROUP


Code Block
languagegroovy
 if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createSellerGroupEntry("SellerGroup")
             .setLabel("Seller(s)")
             .getInput()
 } else {
     SellerGroup.fromMap(input.SellerGroup)
 }


sellerGroupEntry()

createSliderEntry()

SLIDER


Code Block
languagegroovy
 def slider = api.inputBuilderFactory().createSliderEntry("MySlider")
     .setFrom(0)
     .setTo(10)
     .setValue(5)
     .setSubLabels('left', 'right')
     .buildContextParameter();



createStringUserEntry()

STRINGUSERENTRY


Code Block
languagegroovy
 if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createStringUserEntry("String")
             .setLabel("String")
             .setValue("Replace me")
             .getInput()
 } else {
     input.String
 }


stringUserEntry()

createTextUserEntry()

TEXTUSERENTRY


Code Block
languagegroovy
 if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createTextUserEntry("Comments")
             .setLabel("Comment")
             .getInput()
 } else {
     input.Comments
 }


textUserEntry()

createTimeUserEntry()

TIMEUSERENTRY


Code Block
languagegroovy
 if (api.isInputGenerationExecution()) {
     return api.inputBuilderFactory()
             .createTimeUserEntry("Time")
             .setLabel("Time")
             .getInput()
 } else {
     input.Time
 }


timeUserEntry

createUserEntry()

USERENTRY


Code Block
languagegroovy
     if (api.isInputGenerationExecution()) {
     api.inputBuilderFactory()
         .createUserEntry("SalesDiscountPct")
         .setLabel("Sales Discount (%)")
         .setFormatType("PERCENT")
         .getInput()

 } else {
     input.SalesDiscountPct
 }


userEntry(), decimalUserEntry()

...