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:
| Script | Contains |
|---|---|
iaf_dt_proj_colls | Functions for loading the project and collections |
iaf_bimpk_upload | Functions for uploading the bimpk data |
iaf_bimpk_post_imp | Functions for creating relationships between model element data |
iaf_map_elms_type | Functions for mapping model elements to their relevant types and categories |
iaf_files_allusers | |
iaf_dt_model_elems | Functions to load model elements based on criteria |
iaf_obj_model_api | Functions that the ApiConfig endpoints point to |
iaf_import_data_sheets | Function that imports data sheets |
orchestrator | Functions that x orchestrator uses |
iot_normalization | Function that normalizes IoT data |
iaf_import_model | Functions that validate and import the model |
iaf_files_page | Functions for querying files in the project |
Adding custom scripts#
Create a new
.jsfile in thescripts/NextScriptEngine/scriptsfolder.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.
In
scripts/uploadRunnableScripts.js, in thescriptsDescriptorsarray, 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 }]In the
scriptNamesarray, 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 thescriptsDescriptorsarray.const scriptNames = [ ... "iaf_my_cstm_scripts"];