Can I write a custom expression engine function for use in a canonical transform expression?


I know I can write a entire custom transform function, but what if only one of the field transform expressions is complex?

Can I do something like this?

type MyCanonicalTransformType mixes MyDestinationType transforms MyCanonicalType {
  id: ~ expression 'id'
  parent: ~ expression '{"id": parentId}'
  description: ~ expression 'transformDescription(canonicalDescription)'
  transformDescription: function(canonicalDescription: string) : string js server

and implement transformDescription in a JavaScript source file:

function transformDescription(canonicalDescription) {
  var result;
  // Complex logic here

  return result;

My use case is a remix of an existing canonical transform type (implemented with expression-based transforms). One field’s transform needs to be implemented in JavaScript, but I would like to avoid having to duplicate the entire transform.


Hi @matt, have you found an answer to this question?


@lerela Not at this time, but this feature is on the roadmap


Now that saw this (after writing one custom EEF for canonical transformation), I need help: How can one split a string and then take n-th element of the result, using expressions only? There is function split, but then…


Split returns an array of string, so you can get the [n-th] element.

Here’s an example of an expression in a transform:

failureType: ~ expression {id: "split(slot, '_')[1]"}


Thanks, tried something like this (0 instead of 1) but got a syntax error.


Actually, after some more changes, it worked, thanks!


Has the feature mentioned by the OP been implemented - invoke a method on a field in the transform type?