businessobject-function-update
Create or update JavaScript functions in server-side Business Objects to implement custom business logic and integrate with connectors or other business objects.
Instructions
#Create or update a Business Object Function
Creates or updates a JavaScript function within a server-side Business Object. Functions contain business logic code and can call connectors or other business objects.
Common Base Data Type IDs:
String: "22ED1F787B6B0926AB0577860AF7543705341C053EB1B4A74E7CC199A0645E52"
Integer: "B9B1191E0B70BA0845CF4F6A4F4C017594F8BA84FD2F1849966081D53A8C836D"
Boolean: "2788FB5AA776C62635F156C820190D0FD3D558765201881A77382093F7248B39"
Date: "06A9841478D7BE17C423F11C38CD6829E372093DBEC144F2A85FC7165BE8CD80"
Float: "C09139C72F5A8A7E0036BA66CE301748BD617F463683EE03F92EDAAAA4AF8BC7"
Any: "D31053204B4A612390A2D6ECDF623E979C14ADC070A7CB9B08B2099C3011BCAB"
Parameter Structure: Each parameter needs name, dataTypeId, and isOptional. Description and alias are optional.
Code: Standard JavaScript code.
Parameter access in the code: Input parameters can be accessed with let myVar = input.parameter_name; Output parameters can be assigned with output.parameter_name = someOfMyResults; Attention: In case an alias is defined for a parameter, you have use "alias" instead of "parameter_name". Example: output.alias = someOfMyResults; You can do an early return of output, but you don't need to end with a return. The function code will be postfixed with a "return output" anyway. If you do a return instead of return output, then in the first case you will return undefined output parameters - this is most probably not what you want to do.
Business Objects Development Guide
Overview
This guide provides comprehensive information for implementing Business Object functions in Simplifier, including Object API usage, connector access patterns, and Business Object to Business Object communication.
Server-Side Business Object API
The Simplifier object provides access to various server-side methods and components:
Available Components
Logging: Server-side logging capabilities e.g. Simplifier.Log.info("my log") - see details: simplifier://documentation/server-businessobjects/api/Logging
Utilities/Tools: Helper functions and tools - see details: simplifier://documentation/server-businessobjects/api/Utils
Connectors: Access to data connectors - TODO add information later
Business Objects: Access to other Business Objects - see this description
Users: User management - see details: simplifier://documentation/server-businessobjects/api/User
Simplifier.Log.info(...) is logging to a Simplifier Log inside the database. The logged entries can be seen by the user but cannot be accessed by this MCP so far. console.log(...) is logging to the Simplifier logfile. The logged entries can be accessed by Simplifier Administrators only. The MCP cannot access these logs.
Accessing Other Business Objects
Basic Syntax
Examples
Configuration Requirements
Adding Dependencies
When accessing other Business Objects or connectors from a Business Object function, these components MUST be added as dependencies. (see schema for tool about getting, updating and creating Business Objects)
Dependency Types
Business Objects: Other BOs that will be called
Connectors: Data connectors that will be accessed
Dynamic Access Methods
Variables Approach
Dynamic Call Function
Parameter Validation
Security Considerations
Always validate input parameters
Validate data types and ranges for all inputs
Performance Tips
Cache frequently accessed data when appropriate
Avoid unnecessary nested Business Object calls
Debugging Tips
To track down an issue (e.g. the connector issue) put the failing part into a very small bo function and return the result with JSON.stringify as a string, then you can check, whether the expected result is delivered. Indicate in the name of the function, that it can be deleted after debugging.
This documentation provides the essential patterns and best practices for implementing robust Business Object functions in Simplifier. Remember to always add dependencies and follow security best practices when accessing external components. Dependencies for yourself do not need to be added, but you can access own functions like Simplifier.CurrentBusinessObject.(payload?).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| businessObjectName | Yes | ||
| functionName | Yes | ||
| description | No | ||
| code | No | JavaScript function code | return {}; |
| validateIn | No | If true, validates that all mandatory input parameters are present before execution. Catches missing parameters early with clear validation errors (HTTP 422). If false, allows incomplete requests through, resulting in backend errors (HTTP 500). | |
| validateOut | No | If true, validates and filters the output response against the defined datatype structure, returning only defined fields. If false, returns the complete raw API response without filtering or validation. | |
| inputParameters | No | ||
| outputParameters | No |