Table of Contents

Formulas JavaScript V1 Specs 🥱 (obsolete)

V1 formulas were the first formulas introduced. The documentation for them is preserved, as you'll still see them around.

V1 Function Specs

  1. All functions must be called v1, it must be lower case This is important because we cannot guess when the API will change
  2. The first line in the code must start with the function name v1. You cannot put comments or empty lines before the v1
  3. Your function must have brackets afterwards and it can have 0, 1 or two params, so you can use one of the following
    • v1() { ... }
    • v1(data) { ... }
    • v1(data, context) { ...}
  4. The parameter names are anything you want, but the order of what you get is always data and then context. You can also write
    • v1(d, c) { ... }

The data and context Objects

👉🏼 See data

👉🏼 See context

Return a Valid Value

Each field type or property may expect a different data type. Make sure you provide that.

Warning

If you return nothing, undefined or the wrong data type, the result will be ignored and the value/setting will not be changed.

Common Mistakes

  • returning nothing with return; - this will be regarded as an error and be ignored.
  • returning undefined.
  • Returning a falsy instead of a real true or false for a boolean value

History

  • Introduced in 2sxc 12.01
  • Added data.parameters in v13.10
  • Added context.features, context.app, context.user, context.sxc etc. in v13.10