Class ContextParameter

Object
ContextParameter
All Implemented Interfaces:
Serializable

public class ContextParameter extends Object implements Serializable
This class represents the input parameter, the input field. So you can use it to set its label, default value, if required, etc.

The object holds the definition of one input: its name, type, label and settings. It also holds the value that the user entered or selected. The server stores the input definition, including this value, in JSON format.

A logic gets an input in these ways:

Use the setters of this class to change the input. Several methods take this object as an argument, for example quoteProcessor.addOrUpdateInput() in a header logic and layout.addChild() in a form logic.

Example: sets the label, the required flag and the default value of an input that the logic generated earlier:


 def qty = api.integerUserEntry("Quantity")
 def p = api.getParameter("Quantity")
 if (p != null && p.getValue() == null) {
   p.setLabel("Quantity (default: 1)")
   p.setRequired(true)
   p.setValue(1)
 }
 return qty ?: 1
 
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • updateFromFormulaInputDescriptor

      public void updateFromFormulaInputDescriptor(FormulaInputDescriptor fid)
      Not intended for public use. The server calls this method to apply the input settings defined in the configuration of a pricing logic, such as the label, the group and the format.
    • addParameterConfigEntry

      public void addParameterConfigEntry(String key, Object value)
      Technically the same functionality as setConfigParameter(String, Object).

      Unlike setConfigParameter(), this method does not return the input, so you cannot chain further calls.

      Parameters:
      key - The name of the configuration option. See setConfigParameter(String, Object) for the options.
      value - The value of the configuration option.
      See Also:
    • updateWithLookupTable

      public void updateWithLookupTable(LookupTable lt)
      Not intended for public use.

      This is a convenience method to update a ContextParameter with a new version of the same lookup table. This can happen e.g. if a quote is worked on a while and passes a validity date border or an old quote is copied.

      The method does nothing if the input is not a LOOKUP or MATRIXLOOKUP input, or if its name differs from the unique name of the lookup table.

      Parameters:
      lt -
    • isLookupType

      public boolean isLookupType()
      Returns whether this input is a lookup input.
      Returns:
      true if the input type is InputType.LOOKUP or InputType.MATRIXLOOKUP
      See Also:
    • isCustomerParam

      public final boolean isCustomerParam()
      Returns whether this input is a customer input.
      Returns:
      true if the input type is InputType.CUSTOMER
    • isProductParam

      public final boolean isProductParam()
      Returns whether this input is a product input.
      Returns:
      true if the input type is InputType.PRODUCT
    • isProductGroupParam

      public final boolean isProductGroupParam()
      Returns whether this input is a product group input.
      Returns:
      true if the input type is InputType.PRODUCTGROUP
    • isMatrixParam

      public final boolean isMatrixParam()
      Returns whether this input is a matrix lookup input.
      Returns:
      true if the input type is InputType.MATRIXLOOKUP
    • isOptionParam

      public final boolean isOptionParam()
      Returns whether this input is a drop-down input with a single selection.
      Returns:
      true if the input type is InputType.OPTION
      Since:
      3.3 - Cosmopolitan
      See Also:
    • isOptionsParam

      public final boolean isOptionsParam()
      Returns whether this input is a drop-down input with multiple selection.
      Returns:
      true if the input type is InputType.OPTIONS
      Since:
      3.5.4 - Salty Dog
      See Also:
    • isHiddenParam

      public final boolean isHiddenParam()
      Returns whether this input is a hidden input.
      Returns:
      true if the input type is InputType.HIDDEN
      Since:
      3.3 - Cosmopolitan
    • isEnableClientFilter

      public boolean isEnableClientFilter()
      Returns whether the client filter of a table input is on. The client filter allows a user to filter the table by row values. Applies to InputType.INPUTMATRIX and InputType.CONFIGURATORTABLE inputs.
      Returns:
      the boolean flag informing whether the client filter is on (true) or off (false). Turned on by default.
      Since:
      13.0 - Rampur
      See Also:
    • isEnableAdvancedFilter

      public boolean isEnableAdvancedFilter()
      Returns whether the advanced filter of a table input is on. The advanced filter allows a user to filter the table with advanced filters. Applies to InputType.INPUTMATRIX and InputType.CONFIGURATORTABLE inputs.
      Returns:
      the boolean flag informing whether the advanced filter is on (true) or off (false). Turned off by default.
      Since:
      13.0 - Rampur
      See Also:
    • getPreferenceName

      public String getPreferenceName()
      Returns the preference name of an Input Matrix or Configurator Table input. The input builders set it with withPreferenceName(), which stores it as the "preferenceName" configuration option.
      Returns:
      the preference name
      Since:
      13.0 - Rampur
      See Also:
    • isRequired

      public Boolean isRequired()
      Returns whether the input must have a value.
      Returns:
      the required flag set with setRequired(Boolean)
      See Also:
    • setRequired

      public ContextParameter setRequired(Boolean required)
      Sets, if it's mandatory for the input parameter to have a value. The value can be either entered by user or a default value. A required input field is marked with an asterisk (*) in the user interface.

      In case of Quote, all required fields must be populated, otherwise you cannot submit the Quote for approval.

      Example:

      
       api.getParameter("Quantity")?.setRequired(true)
       
      Parameters:
      required - If the input value will be required or not.
      Returns:
      this input
      See Also:
    • getName

      public String getName()
      Returns the name of the input. A logic reads the value of the input under this name, for example input.Quantity.
      Returns:
      the name of the input
    • getLabel

      public String getLabel()
      Returns the label of the input: the text displayed as the label of the input field.
      Returns:
      the label of the input
      See Also:
    • setLabel

      public ContextParameter setLabel(String label)
      Sets the label of the input parameter to the given text.

      Example:

      
       api.getParameter("Quantity")?.setLabel("Quantity (default: 1)")
       
      Parameters:
      label - The text to be displayed as label of the input field.
      Returns:
      this input
      See Also:
    • getLabelTranslations

      public String getLabelTranslations()
      Returns the translations of the label, as a JSON string. The JSON object maps 2-letter language codes (ISO 639-1) to labels, for example {"de":"Menge","es":"Cantidad"}.
      Returns:
      the translations of the label, as a JSON string
      Since:
      3.3 - Cosmopolitan
      See Also:
    • setLabelTranslationsFromMap

      public ContextParameter setLabelTranslationsFromMap(Map<String,String> translations)
      Sets the translations of the label.

      If the label translation is specified for a specific language, then this translation is used when the UI is switched into that language. The translation with an empty language code is used for the languages that have no translation.

      Example:

      
       api.getParameter("Quantity")?.setLabelTranslationsFromMap([
           "de": "Menge",
           "es": "Cantidad"
       ])
       
      Parameters:
      translations - The map that defines language codes (2-letter ISO 639-1) and input field labels.
      Returns:
      this input
      Since:
      5.1 - Collins
      See Also:
    • setLabelTranslations

      public ContextParameter setLabelTranslations(String labelTranslations)
      Sets the translations of the label as a JSON string. To pass the translations as a map, use setLabelTranslationsFromMap(Map).
      Parameters:
      labelTranslations - A JSON object that maps 2-letter language codes (ISO 639-1) to labels, for example {"de":"Menge"}.
      Returns:
      this input
      Since:
      3.3 - Cosmopolitan
      See Also:
    • getFilter

      public Map<String,Object> getFilter()
      Returns the filter of this input, as a map.
      Returns:
      the filter set with setFilter(Map) or setFilters(Filter...)
    • setFilter

      public ContextParameter setFilter(Map<String,Object> filter)
      Sets the filter of this input, as a map. To build the filter from Filter objects, use setFilters(Filter...).
      Parameters:
      filter - The filter, as a map.
      Returns:
      this input
      See Also:
    • setFilters

      public ContextParameter setFilters(Filter... filters)
      Sets the filter of this input from one or more Filter objects. The filters are combined with AND and stored as a map, which getFilter() returns.
      Parameters:
      filters - The filters to combine.
      Returns:
      this input
      See Also:
    • getParameterGroup

      public String getParameterGroup()
      Returns the name of the parameter group (the collapsible section in the UI) that the input belongs to.
      Returns:
      the name of the parameter group
      See Also:
    • setParameterGroup

      public ContextParameter setParameterGroup(String parameterGroup)
      Allows you to create collapsible sections that organize inputs in the UI. You can assign parameterGroup to each parameter, and they will get categorized. The order of parameter groups (sections) is based on the order in which they are "created" (declared) when the logic is executed. There is one default group for all those that do not have parameterGroup assigned.

      This is supported for Quotes, Contracts and Rebate Agreements (not for Configurators).

      Example:

      
       api.getParameter("Quantity")?.setParameterGroup("Volume")
       
      Parameters:
      parameterGroup - The name of the parameter group.
      Returns:
      this input
      See Also:
    • getURL

      public String getURL()
      Returns the URL property of the input. What it holds depends on the input type. For example, for a Configurator input it is the name of the Configurator logic, and for a button it is the URL that the button opens.
      Returns:
      the URL property of the input
      See Also:
    • setURL

      public ContextParameter setURL(String url)
      Sets the URL property of the input. The input builders set this property, for example ButtonInputBuilder.setUrl(String).
      Parameters:
      url - The value of the URL property. See getURL().
      Returns:
      this input
    • getType

      public String getType()
      Returns the input type as a string, for example "OPTION".
      Returns:
      the name of the input type
      See Also:
    • getInputType

      public InputType getInputType()
      Returns the input type.
      Returns:
      the input type
      See Also:
    • applyType

      public ContextParameter applyType(InputType inputType)
      Changes the input type of this input.
      Parameters:
      inputType - The new input type.
      Returns:
      this input
      See Also:
    • getValueHint

      public String getValueHint()
      Returns the value hint: a text that the UI shows with the value of the input. For example, a MULTITIERENTRY input shows it next to its fields. For the customer input of a Quote, the server sets it to the name of the selected customer.
      Returns:
      the value hint
      See Also:
    • setValueHint

      public ContextParameter setValueHint(String hint)
      Sets the value hint: a text that the UI shows with the value of the input.
      Parameters:
      hint - The text of the hint.
      Returns:
      this input
      See Also:
    • getValueOptions

      public String[] getValueOptions()
      Returns the options of a drop-down input, set with setValueOptions(String[]).
      Returns:
      the options of the drop-down input
    • setValueOptions

      public ContextParameter setValueOptions(String[] valueOptions)
      Sets list of options used in the dropdown input field. This works only for input parameters created via api.option() and api.options()

      Example:

      
       api.option("Country")
       // ...
       api.getParameter("Country").setValueOptions(["USA", "DE"])
       
      Parameters:
      valueOptions - The options of the drop-down input field.
      Returns:
      this input
      See Also:
    • setValueOptions

      public ContextParameter setValueOptions(List<String> valueOptions)
      Sets the options of the drop-down input field, as a list. Same as setValueOptions(String[]).
      Parameters:
      valueOptions - The options of the drop-down input field.
      Returns:
      this input
    • getLookupTableId

      public String getLookupTableId()
      Returns the ID of the lookup table that a LOOKUP or MATRIXLOOKUP input reads its values from.
      Returns:
      the ID of the lookup table
      See Also:
    • getValue

      public Object getValue()
      Returns the value of the input: the value that the user entered or selected, or the default value set with setValue(Object). The type of the value depends on the input type.
      Returns:
      the value of the input
      See Also:
    • setValue

      public ContextParameter setValue(Object value)
      Set initial/default value of the input parameter.

      Important: in line item logics, this makes sense only in the "input generation" mode (formerly called Syntax Check mode). You cannot set the initial value of input field later during regular execution.

      In header logics and Configurators, the value set by this method overwrites a value entered by the user when the logic runs again, for example when the user clicks Recalculate on the header.

      Example:

      
       def p = api.getParameter("Quantity")
       if (p != null && p.getValue() == null) {
         p.setValue(1)
       }
       
      Parameters:
      value - The initial value of the input field.
      Returns:
      this input
      See Also:
    • getReadOnly

      public Boolean getReadOnly()
      Returns whether the input field is read-only.
      Returns:
      the read-only flag set with setReadOnly(Boolean)
    • setReadOnly

      public ContextParameter setReadOnly(Boolean readOnly)
      Sets the input field as read-only. The user cannot enter or edit the value in this field.

      Example:

      
       api.getParameter("Quantity")?.setReadOnly(true)
       
      Parameters:
      readOnly - Set to true to set the input field as read-only.
      Returns:
      this input
      See Also:
    • setParameterConfig

      public ContextParameter setParameterConfig(Map<String,Object> parameterConfig)
      Sets the behavior of the input field.

      This method replaces the whole parameter configuration of the input, including the options set before. To add or change one option, use setConfigParameter(String, Object).

      Example:

      
       api.getParameter("Price")?.setParameterConfig(["formatType": "MONEY_USD", "dataType": "float"])
       
      Parameters:
      parameterConfig - Config parameters as a map.
      Returns:
      this input
      See Also:
    • getParameterConfig

      public Map<String,Object> getParameterConfig()
      Returns the parameter configuration of the input: the options that modify how the input field behaves. See setConfigParameter(String, Object) for the options.
      Returns:
      the parameter configuration, as a map of option names and values
      See Also:
    • setUserGroupView

      public ContextParameter setUserGroupView(String userGroupView)

      Sets the userGroupView property for the input. null which means no restrictions.

      Only the members of the specified user groups see the input. For other users, the input is not rendered and is not included when the object is fetched. An empty value also means no restrictions.

      The restriction applies to the top-level inputs of Custom Forms, for example the inputs passed to customFormProcessor.addOrUpdateInput(). It does not apply to nested inputs, such as the inputs of an inline Configurator or of a row layout.

      NOTE:

      • the property is set as a configuration parameter
      • the value can be at most 255 characters long, otherwise the method throws an exception
      • each usage of the method on a single input will override the value
      Example:
      
       def country = api.inputBuilderFactory()
               .createOptionEntry("Country")
               .setOptions(["CZ", "DE", "UK"])
               .buildContextParameter()
       country.setUserGroupView("sales_managers,marketing_team")
       customFormProcessor.addOrUpdateInput(country)
       
      Parameters:
      userGroupView - a user group name, or several user group names separated by commas
      Returns:
      this input
      Throws:
      IllegalArgumentException - if userGroupView is longer than 255 characters
      Since:
      15.0 - Southside
      See Also:
    • setUserGroupView

      public ContextParameter setUserGroupView(List<String> userGroupsView)

      Sets the userGroupView property for the input. null or empty Collection sets the property to null which means no restrictions.

      Works like setUserGroupView(String). Blank names are left out, and the other names are joined with commas.

      NOTE:

      • the property is set as a configuration parameter
      • if concatenation of the user group names (with comma delimiter) exceeds 255 characters, the method throws an exception
      • each usage of the method on a single input will override the value
      Example:
      
       def country = api.inputBuilderFactory()
               .createOptionEntry("Country")
               .setOptions(["CZ", "DE", "UK"])
               .buildContextParameter()
       country.setUserGroupView(["sales_managers", "marketing_team"])
       customFormProcessor.addOrUpdateInput(country)
       
      Parameters:
      userGroupsView - the list of user group names
      Returns:
      this input
      Throws:
      IllegalArgumentException - if the joined user group names are longer than 255 characters
      Since:
      15.0 - Southside
      See Also:
    • getUserGroupView

      public String getUserGroupView()
      Returns the user groups whose members can see the input.
      Returns:
      the user group names, separated by commas
      Since:
      15.0 - Southside
      See Also:
    • setUserGroupEdit

      public void setUserGroupEdit(String userGroupEdit)
      Sets the userGroupEdit property for the input. Only the members of the specified user groups can edit the input. Other users see it as read-only, also when the input is always editable (see setAlwaysEditable(Boolean)). null or an empty value means no restrictions.

      Each usage of the method on a single input overrides the value.

      Example:

      
       api.getParameter("Discount")?.setUserGroupEdit("sales_managers,pricing_team")
       
      Parameters:
      userGroupEdit - a user group name, or several user group names separated by commas
      Since:
      14.0 - Caribou Lou
      See Also:
    • getUserGroupEdit

      public String getUserGroupEdit()
      Returns the user groups whose members can edit the input.
      Returns:
      the user group names, separated by commas
      Since:
      14.0 - Caribou Lou
      See Also:
    • setConfigParameter

      public ContextParameter setConfigParameter(String paramName, Object value)
      Adds an additional configuration parameter/option to the input – a parameterConfig property. This option modifies how the input field behaves.

      You can use following paramName with respective values:

      paramName Description
      formatType Sets the format type of the input field (e.g. for "PERCENT" the input will be displayed with % sign and the value returned will be 0..1 instead of 0..100). For possible values, see the FieldFormatType enum.
      from Sets the minimum value of the allowed value range. Applicable to the following input types: INTEGERUSERENTRY, USERENTRY, DATETIMEUSERENTRY (accepts date limits only), DATEUSERENTRY, SLIDER.
      to Sets the maximum value of the allowed value range. Applicable to the following input types: INTEGERUSERENTRY, USERENTRY, DATETIMEUSERENTRY (accepts date limits only), DATEUSERENTRY, SLIDER.
      labels Sets labels to be used for the options, For example ["USA":"United States of America, "DE":"Germany]. Applicable to the OPTION input type.
      disabled Hides the input from the user interface. Supported input types: InputType.CONFIGURATOR (hides the "Open" button).
      dataType Sets the data type of the input field. For example "float", or "integer". Applicable to the following input types: USERENTRY, BOOLEANUSERENTRY, DATEUSERENTRY, DATETIMEUSERENTRY, HIDDEN, INTEGERUSERENTRY, PARSABLEINPUTFILE, QUOTETYPE, REBATEAGREEMENT, TEXTUSERENTRY, TIMEUSERENTRY.
      noRefresh Boolean – Applicable to input fields within a Configurator only. Prevents the Configurator refresh when the value of the field is changed. See setNoRefresh() for more details.
      dmSourceName Name of DS or DM (only for DMFilterBuilder, DMFields or DMField).
      typeCode String – sets the type to be filtered. For FILTERBUILDER input type only.
      targetPage Opens the target location (AppPage). Applicable to the BUTTON input type only. See setTargetPage() for more details.
      targetPageState Opens the particular object detail in the specified location (set by the targetPage). Applicable to the BUTTON input type only. See setTargetPageState() for more details.
      filterFormula Name of the logic which will provide a filter used to limit products/customers in the picker. Example: cp.setConfigParameter("filterFormula", ["name": "ProductFilter_Logic"]). Applicable to the following input types: PRODUCT, PRODUCTGROUP, CUSTOMER, CUSTOMERGROUP.
      autoFocus Boolean – If this is set to true, browser scrolls to the element when the page is loaded and automatically focuses it (places a cursor into the input field). For the radio group, the first element will be focused. If the input is in the read-only mode, autofocus will not be applied.
      sortType String – ASC or DESC. Applicable to MULTITIERENTRY input type only.
      validationType String – VALIDATE or NO_VALIDATION. Applicable to MULTITIERENTRY input type only.
      hideAddButton Boolean – Set to true to hide the "Add" button, including the "Duplicate” icon displayed next to each item. Applicable to INPUTMATRIX input type only.
      hideRemoveButton Boolean – Set to true to hide the "Remove" button. Applicable to INPUTMATRIX input type only.
      canModifyRows Boolean – Set to false to hide "Add" and "Remove" buttons. Applicable to INPUTMATRIX input type only.
      readOnlyColumns Specifies columns (as a list) that are set as read only. Applicable to INPUTMATRIX input type only.
      noCellRefresh Boolean – Prevents the Configurator refresh when the value of the Input Matrix cell is edited. Applicable to INPUTMATRIX input type only.
      defaultHeight Number that defines the maximum Input Matrix table height. If there are more entries than the defined default height the scroll bar appears. Applicable to INPUTMATRIX input type only.
      fixTableHeight Boolean that sets the fixed height of the table. Default: true. Applicable to INPUTMATRIX input type within the Configurator only.
      "enableClientFilter" Allows a user to filter the table by row values. Default: true (the filtering is enabled).

      Example: cp.setConfigParameter("enableClientFilter", false). Applicable to InputType.INPUTMATRIX and InputType.CONFIGURATORTABLE inputs type only.

      "enableAdvancedFilter" Allows a user to filter the table by advance filters. Default: false (the filtering is disabled).

      Example: cp.setConfigParameter("enableAdvancedFilter", false). Applicable to InputType.INPUTMATRIX and InputType.CONFIGURATORTABLE inputs type only.

      hiddenColumns Specifies table columns (as a list) that are hidden from the user interface. Applicable to INPUTMATRIX input type within the Configurator only.
      columnValueOptions Specifies options for the drop-down menu for the Option column type. Example: cp.setConfigParameter("columnValueOptions", ["column1" : ["Team Leader","Technical Expert","Observer","Member","Critic"]]). Applicable to INPUTMATRIX input type only.
      columnType Sets types for the table columns. Example: cp.setConfigParameter("columnType", ["Option","Numeric","Text","Date"]). Applicable to INPUTMATRIX input type only.
      disableRowSelection Set to true to disable the row selection (to hide the check-box). Applicable to INPUTMATRIX input type only.
      columnLabels Sets column labels. Example: cp.setConfigParameter("columnLabels", ["First Column", "Second Column"]) Applicable to INPUTMATRIX input type only.
      requiredColumns Sets columns a required. Example: cp.setConfigParameter("requiredColumns", ["col1", "col2"]) Applicable to INPUTMATRIX input type only.
      "enableInputValueTracking_Previous" Sets the input to previous value trackable.

      Example: cp.setConfigParameter("enableInputValueTracking_Previous", true).

      "enableInputValueTracking_Default" Sets the input to default value trackable.

      Example: cp.setConfigParameter("enableInputValueTracking_Default", true).

      "enableInputValueTracking_ValueChangedByLogic" Sets the input to value change-by-groovy-logic trackable.

      Example: cp.setConfigParameter("enableInputValueTracking_ValueChangedByLogic", true).

      "enableAddActions" turn on/off the ability to add rows in the table (turn on by the default).

      Example: cp.setConfigParameter("enableAddActions", false).

      "preferenceName" set the preference name.

      Example: cp.setConfigParameter("preferenceName", 'somePreferenceName').

      "maxLength" set the maximum length of an input (without validation) for STRINGUSERENTRY and TEXTUSERENTRY inputs.

      Example: cp.setConfigParameter("maxLength", 4).

      "minLength" set the minimum length of an input (without validation) for STRINGUSERENTRY and TEXTUSERENTRY inputs.

      Example: cp.setConfigParameter("minLength", 2).

      Example:

      
       api.getParameter("Discount")?.setConfigParameter("formatType", "PERCENT")
       
      Parameters:
      paramName - The name of the configuration option. See the table above.
      value - The value of the configuration option.
      Returns:
      this input
      See Also:
    • clearConfigParameter

      public void clearConfigParameter(String paramName)
      Clears the value of a configuration option: sets it to null.
      Parameters:
      paramName - The name of the configuration option. See setConfigParameter(String, Object).
      See Also:
    • getFormattingOptions

      public Map<String,Object> getFormattingOptions()
      Returns the formatting options of the input: the options that influence how the input field looks. See setFormattingOption(String, Object) for the options.
      Returns:
      the formatting options, as a map of option names and values
      Since:
      7.0 - Bijou
      See Also:
    • setFormattingOptions

      public void setFormattingOptions(Map<String,Object> formattingOptions)
      Allows you to set desired formatting options of the input field as a map. For setting a particular formatting option see setFormattingOption(String, Object).

      This method replaces all formatting options of the input, including the options set before.

      Parameters:
      formattingOptions - The formatting options, as a map of option names and values.
      Since:
      7.0 - Bijou
      See Also:
    • isStoreAuditTrail

      public Boolean isStoreAuditTrail()
      Returns whether the logged changes of this input are kept as an audit trail.
      Returns:
      the flag set with setStoreAuditTrail(Boolean)
      Since:
      15.0 - Southside
      See Also:
    • setStoreAuditTrail

      public ContextParameter setStoreAuditTrail(Boolean storeAuditTrail)
      Sets whether the logged changes of this input are kept as an audit trail. Applies only to an input whose changes are recorded in the activity log (see setLogActivity(Boolean)).

      The activity log is cleaned up automatically. The clean-up deletes the logged input changes of a document when the document is approved, deleted or not changed for 30 days (by default). The changes of an input with this flag set to true are not deleted.

      Example:

      
       api.getParameter("Discount")?.setLogActivity(true)?.setStoreAuditTrail(true)
       
      Parameters:
      storeAuditTrail - Set to true to keep the logged changes of the input.
      Returns:
      this input
      Since:
      15.0 - Southside
      See Also:
    • isLogActivity

      public Boolean isLogActivity()
      Returns whether the changes of this input are recorded in the activity log.
      Returns:
      the flag set with setLogActivity(Boolean)
      Since:
      15.0 - Southside
      See Also:
    • setLogActivity

      public ContextParameter setLogActivity(Boolean logActivity)
      Sets whether the changes of this input are recorded in the activity log of the document. Applies to Quotes, Agreements/Promotions, Rebate Agreements and Compensation Plans.

      By default, the changes of inputs generated by a logic are not recorded. The default customer, customer group, product and product group inputs are recorded unless you set this flag to false.

      Example:

      
       api.getParameter("Discount")?.setLogActivity(true)
       
      Parameters:
      logActivity - Set to true to record the changes of the input in the activity log.
      Returns:
      this input
      Since:
      15.0 - Southside
      See Also:
    • setFormattingOption

      public ContextParameter setFormattingOption(String optionName, Object value)
      Sets (adds or updates) a formatting option (how the input field is displayed) within the formattingOptions map.

      Example – creates an input field and sets the placeholder:

      
       def ce = api.createConfiguratorEntry()
      
       cp = ce.createParameter(InputType.STRINGUSERENTRY, "stringInputField")
       cp.setLabel("String Input Field")
       cp.setFormattingOption("placeholder","I hold the place")
      
       
      Possible values of the optionName parameter:
      optionName Description
      placeholder See setPlaceholderText() for more details.
      defaultWidth See setDefaultWidth() for more details.
      width See setWidth() for more details.
      title See setTitle() for more details.
      helpText See setHelpText() for more details.
      helpLink See setHelpLink() for more details.
      customAttributeName See setCustomAttributeName() for more details.
      customAttributeValue See setCustomAttributeValue() for more details.
      flex See setFlex() for more details.
      Parameters:
      optionName - See the table above.
      value - The value of the formatting option.
      Returns:
      this input
      Since:
      7.0 - Bijou
      See Also:
    • getAddUnknownValues

      public Boolean getAddUnknownValues()
      Returns the flag set with setAddUnknownValues(Boolean).
      Returns:
      the flag set with setAddUnknownValues(Boolean)
      Since:
      3.4.4 - Cuba Libre
    • setAddUnknownValues

      public ContextParameter setAddUnknownValues(Boolean addUnknownValues)
      Sets whether the user can add values that are not among the options of an OPTIONS input. Only the Classic UI supported this setting.
      Parameters:
      addUnknownValues - Set to true to allow values that are not among the options.
      Returns:
      this input
      Since:
      3.4.4 - Cuba Libre
    • getTypedId

      public String getTypedId()
      Returns the typed ID of the object that the logic runs for, for example the typed ID of the Quote when the Quote is calculated. The server sets it on the inputs that a pricing logic generates.
      Returns:
      the typed ID of the object
      See Also:
    • setTypedId

      public ContextParameter setTypedId(String typedId)
      Sets the typed ID returned by getTypedId().
      Parameters:
      typedId - The typed ID of the object that the logic runs for.
      Returns:
      this input
      Since:
      3.5 - Salty Dog
    • getAlwaysEditable

      public Boolean getAlwaysEditable()
      Returns whether the input field is always editable.
      Returns:
      the flag set with setAlwaysEditable(Boolean)
      Since:
      3.6 - El Presidente
      See Also:
    • setAlwaysEditable

      public ContextParameter setAlwaysEditable(Boolean alwaysEditable)
      Sets the input field as always editable. Enables a user to update the input field after the Quote, Agreement/Promotion, Rebate Agreement or Compensation Plan has been submitted. It does not apply to superseded and invalidated documents.

      Users who cannot edit the input because of setUserGroupEdit(String) still see it as read-only.

      Example:

      
       api.getParameter("DeliveryDate")?.setAlwaysEditable(true)
       
      Parameters:
      alwaysEditable - Set to true to set the input field as always editable.
      Returns:
      this input
      Since:
      3.6 - El Presidente
      See Also:
    • addInput

      public void addInput(ContextParameter contextParameter)
      Adds a nested input. This input can be of any type. This is intended to be used when the parent input is of type InputType.ROW or type InputType.COLLAPSE. Depending on the parent type, it is also expected that the added input will have a flex attribute.

      Form logics (Forms 2.0) do not support the ROW and COLLAPSE inputs. Arrange the inputs of a form with its layout instead (see FormLayout).

      Parameters:
      contextParameter - the input to add
      Since:
      8.0 - Godfather
      See Also:
    • getInputs

      public List<ContextParameter> getInputs()
      Returns the nested inputs of a ROW or COLLAPSE input.
      Returns:
      the inputs added with addInput(ContextParameter)
      Since:
      8.0 - Godfather
    • getRegisteredFrontendEvents

      public Map<String,Map<String,List<String>>> getRegisteredFrontendEvents()
      Returns the frontend events registered for this input with onClick() or onValueChange() of the input builder. The key of the map is the name of the event, onClick or onValueChange. The value holds the settings of the event:
      • lockInputNames: the names of the inputs that are locked while the event is processed
      • excludeInputNames: the names of the inputs whose values are not sent to the server with the event (present only when set)
      Returns:
      the registered events, as a map of event names and event settings
      Since:
      17.0 - Paloma
      See Also:
    • setRegisteredFrontendEvents

      public void setRegisteredFrontendEvents(Map<String,Map<String,List<String>>> registeredFrontendEvents)
      Not intended for public use. Use onClick() or onValueChange() of the input builder instead. Sets the registered frontend events. Event configs persisted before PFUN-36398 use the legacy "lockInputNames" key, which is renamed to "dependentInputs" so that the frontend only ever sees the current key.
      Since:
      17.0 - Paloma
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setIfNotNull

      public void setIfNotNull(@NotNull ContextParameter original)
      Not intended for public use.

      Copy attributes from the original ContextParameter apart from: name, lookupTableId, type, inputs, valueHint, userGroupEdit and registeredFrontendEvents. Only the attributes that are not null in the original are copied.

      Parameters:
      original - ContextParameter as a source for the attributes' copy if not null
    • copyWithoutValue

      public ContextParameter copyWithoutValue()
      Not intended for public use.

      Returns a new input with the name, type, label, lookup table ID, URL, required and read-only flags, parameter group, activity log flags, filter and parameter configuration of this input. The value and the other attributes are not copied.

      Returns:
      the copy of this input without the value
    • update

      public void update(ContextParameter cp)
      Not intended for public use.

      Copies the attributes of another input to this input, including the value. The name, type, label translations, formatting options, nested inputs, userGroupEdit and registered frontend events are not copied. The method does nothing when cp is null or when its name or type differs from this input.

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object