Custom Function
The sdk.customFunction field allows you to programmatically call other Custom Functions from within your current view. This is particularly useful when you need to reuse logic, fetch data, or trigger actions defined in other functions—either in the same app or globally within the tenant.
All function calls are asynchronous and return a Promise.
API
sdk.customFunction.callAsync({ pathString, _id }, payload)
| Parameter | Type | Description |
|---|---|---|
pathString | string | The relative or absolute path to the target custom function. |
_id | string | (Optional) ID of the function if calling by database ID. |
payload | object | Payload object passed to the target function. |
Example
const result = await sdk.customFunction.callAsync({
pathString: sdk.utils.absolutePathString('../../methods/leads/list.js')
}, {
filtering: { status: 'active' },
pagination: { currentPage: 1, pageItems: 20 }
})
const leads = result?.datas
You can then use the returned data to render components, fill dropdowns, update state, etc.