Skip to main content
Version: v5.0

Project scripts

Any object model scripts required for the app are stored in the scripts/NextScriptEngine/scripts folder. During the project setup, these scripts are uploaded to the Item Service as Script class objects.

The current Reference App implementation contains the following object model scripts:

ScriptContains
iaf_dt_proj_collsFunctions for loading the project and collections
iaf_bimpk_uploadFunctions for uploading the bimpk data
iaf_bimpk_post_impFunctions for creating relationships between model element data
iaf_map_elms_typeFunctions for mapping model elements to their relevant types and categories
iaf_files_allusers
iaf_dt_model_elemsFunctions to load model elements based on criteria
iaf_obj_model_apiFunctions that the ApiConfig endpoints point to
iaf_import_data_sheetsFunction that imports data sheets
orchestratorFunctions that x orchestrator uses
iot_normalizationFunction that normalizes IoT data
iaf_import_modelFunctions that validate and import the model
iaf_files_pageFunctions for querying files in the project

Adding custom scripts#

  1. Create a new .js file in the scripts/NextScriptEngine/scripts folder.

    Note: If you plan to use the script with an orchestrator or OMAPI, ensure your script content follows the guidelines in Script Engine script content.

  2. In scripts/uploadRunnableScripts.js, in the scriptsDescriptors array, add an object that defines your script:

    const scriptsDescriptors = [  ...  {    _name: "My Custom Scripts", //A descriptive name for the script    _shortName: "iaf_my_cstm_scripts", //A short reference name for the script that must match the script file name    _description: "My custom scripts for my custom page", //Add a description    _userType: "iaf_my_cstm_scripts" //A shared or unique name with underscores to identify the script  }]
  3. In the scriptNames array, add the file name of your custom script without the file extension. The index of your script name must match the index of your Script definition in the scriptsDescriptors array.

    const scriptNames = [  ...  "iaf_my_cstm_scripts"];