Blog navigation

Latest posts

EXEC_JS / streamline.js / Sage X3 Syracuse Javascript bundles

 

Bridging the Gap between 4GL and JavaScript for Enhanced Development in Sage X3

Sage X3 4GL encounters limitations when developing cryptographic functions. To address this, Sage has devised a solution by creating a 'bridge' between 4GL and JavaScript.

Essentially, it's now possible to develop JavaScript functions that can be deployed at the Syracuse level within the node.js framework and called from Sage X3. This approach also applies to how the editor handles complex functions like 'Chorus.'

This method proves highly advantageous in various scenarios:

  • Handling multiple complex certificates expected to communicate via a webservice, which Syracuse cannot manage due to encryption methods or limitations in the number of certificates.
  • Addressing functions that don't exist within the 4GL environment.
  • Utilizing advanced parsing methods within JavaScript.

To facilitate the process of setting up a JavaScript bundle module, numerous articles explain the steps involved. You can find more information in the 'Online Help' section by searching for the keyword 'javascript bundles.'

This article focuses on two aspects not extensively covered in the official documentation, which can save you from encountering days of challenges:

  • Asynchronous vs Synchronous:
  • Streamline.js:

To address this challenge, Sage introduced a JavaScript layer named 'streamline.js.' This layer effectively converts asynchronous JavaScript functions into synchronous ones. For more details, you can refer to the repository: streamline.js on GitHub. When using this layer, adhering to some fundamental rules is crucial:

  • Your JavaScript file extension should be '.\_js' instead of '.js.' This distinction enables the layer's transformation.
  • Integration of a callback in your JavaScript function is essential. This callback diverges from the classic JavaScript style and is marked by an underscore in the function.

To validate your JavaScript code, you can launch the 'node.exe' process with your JavaScript file. However, it's recommended to first rectify your JavaScript code without a callback and subsequently implement the callback concept.

 
Posted in: Sage X3, 4GL, Javascript