runjsfunction-xif
Web icon

RunJsFunction

Stable version 1.0.2 (Compatible with OutSystems 11)
Uploaded
 on 01 December 2022
 by 
5.0
 (1 rating)
runjsfunction-xif

RunJsFunction

Details
The RunJsFunction lets you run javascript on the serverside. There is no need to install anything on your server like NodeJs or a webbrowser. It uses the Jint engine (.net library) to perform javascript operations.
Read more

How it works:

There are 2 input parameters to this extension. “input” and “script”. Both should be as a plain string but “input” can be Json formatted. The result should be:

Input:
{
  "amount" : "3",
  "price" : "4"
}
Script:
input = JSON.parse(input);
input.total = (input.amount * input.price).toString();
input = JSON.stringify(input, null, "\t");
Output:
{
                "amount": "3",
                "price": "4",
                "total": "12"
}

 

Practical usages:

Although almost all logic can be performed by coding in OutSystems. This tool lets you create logic without the need to build and release. Scripts can be saved and retrieved from the database so that would be the only logic you need to build in OutSystems.

We currently use it to map one Json object to another. When working with a lot of structures this tool makes life a little easyer.

Implementation:

The RunJsFunction Editor will soon be available on the forge using CoreMirror as an IDE to write your scripts.

Resources:

https://archive.codeplex.com/?p=jint

Release notes (1.0.2)

Input is working now

Reviews (0)
Team
Other assets in this category
More from Danny Prager