Home / JSON Structure / uiOptions

uiRules

uiRule Description Example
description Used internally, as a comment for a person, who is configuring a JSON file. This uiRule is optional.
    
uiRules: [
  {
    "description": "Rule 1",
    "trigger": "onChange",
    "action": "showByValue",
    "source": "client"
    "target": "client.name"
  },
  {
    "description": "Rule 2",
    "trigger": "onLoad",
    "action": "setDate",
    "target": "quote.expiryDate",
    "parameters": {
      "years": 1 
    }
  }
]
    
    
trigger Describes event, which will trigger the action on an element. This uiRule is mandatory.
Possible triggers:
  • onChange- element value is changed
  • onClick- element is clicked
  • onLoad- element is loaded
  • onRowAdded- new row is included into the uiType multiSection
action Defines the action to be performed on an element. For more information, see Actions. This uiRule is mandatory.
target Element, that will be affected by the action. A full path to the element file has to be defined. This uiRule is mandatory.
parameters Set of parameters, which are specific to the action. For more information, see Actions. This uiRule is optional.
condition Sets in what circumstances the target will be affected. This uiRule is optional.
source Element, from which data, properties and parameters are taken for action. This uiRule is optional.

Actions

toggleVisibility

Switches visibility of the target element when the toggler value is changed.

Example

{
  "properties": {
    "totalPremium": {
      "label": "Total Premium",
      "uiType": "money",
      "uiOptions": {
        "class": "col-4"
      }
    },
    "claimsHandler": {
      "label": "Will MGA be handling the claims?",
      "uiType": "toggler",
      "default": true,
      "uiOptions": {
        "required": true,
        "class": "col-4"
      },
      "uiRules": [
        {
          "trigger": "onChange",
          "action": "toggleVisibility",
          "target": "quote.totalPremium"
        }
      ]
    }
  }
}

setValue

Sets the value as defined in the parameter array or takes the value from the defined source. It can be used with the condition key, with a math expression in brackets. The argument is taken from the action source field. Also, the evaluate expression might be useful. For more information on math expression, click here.

Example

{
  "trigger": "onChange",
  "action": "setValue",
  "target": "quote.fieldB",
  "condition": "equal(quote.fieldC)",
  "parameters": 10
  },
{
  "trigger": "onChange",
  "action": "setValue",
  "target": "quote.fieldC",
  "condition": "range(100, 120)",
  "parameters": 11
},

setToday

Sets the today date for target.

Example

{
"entryDate": {
  "label": "Entry Date",
  "uiType": "date",
  "uiOptions": {
    "readonly": true,
    "class": "col-4",
    "quoteField": "issue_date"
  },
  "uiRules": [
    {
      "trigger": "onLoad",
      "action": "setToday",
      "target": "quote.entryDate"
    }
  ]
}
}

setDate

Sets the target element when the source value is equal to the value defined in parameters.

Example

{
"entryDate": {
  "label": "Entry Date",
  "uiType": "date",
  "uiOptions": {
    "class": "col-4",
    "quoteField": "created_at"
  },
  "uiRules": [
    {
      "trigger": "onLoad",
      "action": "setToday",
      "target": "submission.entryDate"
    },
    {
      "trigger": "onLoad",
      "action": "setDate",
      "target": "submission.inceptionDate",
      "source": "submission.entryDate",
      "parameters": {
        "days": 1
      }
    }
  ]
}

showByValue

Shows the target element when the source value is equal to the value defined in parameters.

Example

{
"totalPremium": {
  "label": "Total Premium",
  "uiType": "money",
  "uiOptions": {
    "class": "col-4"
  },
  "uiRules": [
    {
      "trigger": "onChange",
      "source": "source.professionalLiability",
      "action": "showByValue",
      "target": "quote.claims",
      "parameters": 5000
    }
  ]
},
}
}

showByValueLt

Shows the target element when the source value is lower then the value defined in parameters.

Example

{
"totalPremium": {
  "label": "Total Premium",
  "uiType": "money",
  "uiOptions": {
    "class": "col-4"
  },
  "uiRules": [
    {
      "trigger": "onChange",
      "source": "source.professionalLiability",
      "action": "showByValueLt",
      "target": "quote.claims",
      "parameters": 5000
    }
  ]
},
}

showByValueLte

Shows the target element when the source value is lower or equal then the value defined in parameters.

Example

{
"totalPremium": {
  "label": "Total Premium",
  "uiType": "money",
  "uiOptions": {
    "class": "col-4"
  },
  "uiRules": [
    {
      "trigger": "onChange",
      "source": "source.professionalLiability",
      "action": "showByValueLte",
      "target": "quote.claims",
      "parameters": 5000
    }
  ]
},
}

showByValueGt

Shows the target element when the source value is greater then the value defined in parameters.

Example

{
"totalPremium": {
  "label": "Total Premium",
  "uiType": "money",
  "uiOptions": {
    "class": "col-4"
  },
  "uiRules": [
    {
      "trigger": "onChange",
      "source": "source.professionalLiability",
      "action": "showByValueGt",
      "target": "quote.claims",
      "parameters": 5000
    }
  ]
},
}

showByValueGte

Shows the target element when the source value is greater or equal then the value defined in parameters.

Example

{
"totalPremium": {
  "label": "Total Premium",
  "uiType": "money",
  "uiOptions": {
    "class": "col-4"
  },
  "uiRules": [
    {
      "trigger": "onChange",
      "source": "source.professionalLiability",
      "action": "showByValueGte",
      "target": "quote.claims",
      "parameters": 5000
    }
  ]
},
}

showField

Shows a field when a condition is met. It can be used with the condition key, with a math expression in brackets. The argument is taken from the action source field. Also, the evaluate expression might be useful. For more information on math expression, click here.

Example

{
  "trigger": "onLoad",
  "action": "showField",
  "target": "quote.fieldD",
  "condition": "largerEq(121)"
},
{
  "trigger": "onChange",
  "action": "showField",
  "target": "quote.fieldD",
  "condition": "largerEq(121)"
},
{
  "trigger": "onChange",
  "action": "showField",
  "target": "quote.fieldD",
  "condition": "evaluate(quote.fieldC == quote.fieldA)"
}

hideByValue

Hides the target element when the source value is equal to the value defined in parameters.

Example

{
"totalPremium": {
  "label": "Total Premium",
  "uiType": "money",
  "uiOptions": {
    "class": "col-4"
  },
  "uiRules": [
    {
      "trigger": "onChange",
      "source": "source.professionalLiability",
      "action": "hideByValue",
      "target": "quote.claims",
      "parameters": 5000
    }
  ]
},
}

calculate

Calculates the value defined in parameters.

Example

{
"brokerComm": {
  "label": "Broker Commission %",
  "uiType": "decimal",
  "uiOptions": {
    "class": "col-3 offset-right-3"
  },
  "uiRules": [
  {
    "trigger": "onChange",
    "action": "calculate",
    "target": "parameters.grossComm",
    "parameters": "parameters.humnComm"
    }
  ]
}
}

calculateTable

Takes values from one table with the moneyTable uiType, calculates and displays calculated values on another moneyTable.

Example

{
  "mgaPart": {
    "label": "MGA Participation",
    "uiType": "number",
    "default": "100",
    "uiOptions": {
      "class": "col-3",
      "icon": "fe fe-percent"
    },
    "uiRules": [
      {
        "trigger": "onChange",
        "action": "calculateTable",
        "target": "mgasharetable",
        "parameters": "premiumtable * quote.mgaPart / 100"
      }
    ]
  },
}

sumEndorsements

Sums up all quote endorsements premiums, deductibles, limits or other fields and assigns the value to the target element. The following parameters are used:

  • onlyCurrentVersion - not required, defined if all versions of endorsements must be summed up, or just current.
  • amount - required, defined which endorsements field must be summed up.
  • currency - not required, if the target uiType is currency.

Example

{
"fleetendorsementsSum": {
  "label": "Fleet Endorsements Sum",
  "uiType": "money",
  "uiOptions": {
    "class": "col-6"
  },
  "uiRules": [
    {
      "trigger": "onChange",
      "action": "sumEndorsements",
      "source": "fleetendorsements",
      "target": "premium.fleetendorsementsSum",
      "parameters": {
        "onlyCurrentVersion": true,
        "amount": "deductible",
        "currency": "eur"
      }
    }
  ]
}
}

getDateDiff

Sets the target as a difference of year, months, days between to values defined in source.

Example

{
"uiRules": [
  {
    "trigger": "onChange",
    "action": "getDateDiff",
    "target": "submission.daysRemaining",
    "source": [
      "submission.inceptionDate",
      "submission.expiryDate"
    ],
    "parameters": "days"
  }
]
}