Input Functions
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) |
---|---|---|---|
| Use this method to select a user. Returns the user's login name (not the full user object). if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createAnyUserEntry("AnyUser")
.setLabel("AnyUser")
.getInput()
} else {
input.AnyUser
} | ||
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createBooleanUserEntry("Boolean")
.setLabel("Boolean")
.getInput()
} else {
input.Boolean
} | ||
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createConfiguratorInputBuilder("form", "ConfiguratorLogic", false)
.setLabel("Configurator")
.getInput()
} else {
input.form
} | ||
| def ce = api.createConfiguratorEntry()
def button = api.inputBuilderFactory()
.createButtonEntry("button")
.setLabel("Button")
.setTargetPage(AppPages.MD_PRODUCTS_PAGE)
.buildContextParameter()
return ce.createParameter(builder) | not available | |
| 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 | |
| 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 | |
| Creates an empty configurator entry object. Must be filled with inputs by calling def formSection = api.createConfiguratorEntry()
def param = api.inputBuilderFactory()
.createOptionEntry(name)
.setLabel(label)
.setOptions(optionValues)
.buildContextParameter()
formSection.createParameter(param)
return formSection
} | ||
| 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)
| ||
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createCustomerEntry("customer")
.setLabel("Select a customer")
.getInput()
} else {
input.Customer
}
| ||
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createCustomerGroupEntry("CustomerGroup")
.setLabel("Customer(s)")
.getInput()
} else {
CustomerGroup.fromMap(input.CustomerGroup)
} | ||
| 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 | |
| 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 | |
| def input = api.inputBuilderFactory()
.createDashboardPopup("Dashboard")
.setFilter(Filter.ilike("uniqueName", "<prefix>%"))
.getInput() | not available | |
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createDateRangeUserEntry("DateRange")
.setLabel("Select start date and end date")
.getInput()
} else {
api.parseDate("yyyy-MM-dd", input.DateRange)
} | ||
| 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)
} | ||
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createDateUserEntry("Date")
.setLabel("Select date")
.getInput()
} else {
api.parseDate("yyyy-MM-dd", input.Date)
} | ||
| def ctx = api.getDatamartContext()
def dm = ctx.getDatamart("Sales_Data")
def period = dm.getColumn("Country")
return ctx.dimFilterEntry("Customer Country", period) | ||
| 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 | |
| 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 | |
| def dm = api.inputBuilderFactory()
.createDmFilter("Select a product", "DM.datamart_transaction", "ProductID")
.buildMap()
quoteProcessor.addOrUpdateInput(dm) | ||
| 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 | ||
| 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 | |
| def param = api.inputBuilderFactory()
.createDmQueryBuilder("query")
.setLabel("Build your query")
.getInput() | not available | |
| 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 | |
| def builder = api.inputBuilderFactory()
.createDMSource("DMSource")
.setLabel("Select the Field Collection Source")
.setTypes("DMDS", "DM")
return libs.InputLib.Input.inputParamBuilder(out, builder) | not available | |
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createFilterBuilder("FilterBuilder", "P")
.setLabel("Set a product filter")
.getInput()
} else {
input.FilterBuilder
} | ||
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createHiddenEntry("hidden")
.setLabel("Hidden")
.getInput()
}
return input.hidden | not available | |
| The following code snippet creates an input matrix: 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
}
| ||
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createIntegerUserEntry("Integer")
.setLabel("Enter a whole number")
.setPlaceholderText("23")
.getInput()
} else {
input.Integer
} | ||
| It renders a list of input tuples – Target & Value. Example 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
This code will multiply the values (the 2nd column) with the given numberdef tieredVal = input.multiTier
tieredVal = tieredVal.multiplyValues(0.01) Conversion of the returned value (List of TieredValue) to Mapinput.multiTier?.asMap() See the TieredValue class documentation. | ||
| 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
} | ||
| 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
} | ||
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createProductEntry("Product")
.setLabel("Select a product")
.getInput()
} else {
input.Product
} | ||
| 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 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. def builder = api.inputBuilderFactory().createParsableInputTypeFile("File")
return libs.InputLib.Input.inputParamBuilder(out,builder) | ||
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createProductGroupEntry("ProductGroup")
.setLabel("Select products")
.getInput()
} else {
ProductGroup.fromMap(input.ProductGroup)
} | ||
| def builder = api.inputBuilderFactory().createQuoteType("New quote")
return libs.InputLib.Input.inputParamBuilder(out,builder) | not available | |
| def radio = api.inputBuilderFactory()
.createRadioEntry('radioEntry')
.setOptions(['Yes', 'No'])
.setValue('No')
.setLabel('Yes or no?')
.buildMap() | not available | |
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createRebateAgreement("RebateAgreement")
.setLabel("Select a Rebate Agreement")
.getInput()
} else {
input.RebateAgreement
}
| ||
| 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 | |
| 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 | ||
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createSellerEntry("Seller")
.setLabel("Select a seller")
.getInput()
} else {
input.Seller
} | ||
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createSellerGroupEntry("SellerGroup")
.setLabel("Seller(s)")
.getInput()
} else {
SellerGroup.fromMap(input.SellerGroup)
} | ||
| def slider = api.inputBuilderFactory().createSliderEntry("MySlider")
.setFrom(0)
.setTo(10)
.setValue(5)
.setSubLabels('left', 'right')
.buildContextParameter(); | ||
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createStringUserEntry("String")
.setLabel("String")
.setValue("Replace me")
.getInput()
} else {
input.String
} | ||
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createTextUserEntry("Comments")
.setLabel("Comment")
.getInput()
} else {
input.Comments
} | ||
| if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createTimeUserEntry("Time")
.setLabel("Time")
.getInput()
} else {
input.Time
} | ||
| if (api.isInputGenerationExecution()) {
api.inputBuilderFactory()
.createUserEntry("SalesDiscountPct")
.setLabel("Sales Discount (%)")
.setFormatType("PERCENT")
.getInput()
} else {
input.SalesDiscountPct
} |
You can reference the inputs using input.<parameter name>
.
Example - if not in the InputGenerationExecution
mode, then retrieve the "Comments" field value:
if (api.isInputGenerationExecution()) {
return api.inputBuilderFactory()
.createTextUserEntry("Comments")
.getInput()
} else {
input.Comments
}
Related content
Found an issue in documentation? Write to us.