Skip to main content

Custom Function

The sdk.customFunction field allows you to programmatically call other Custom Functions from within your current function. 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)

ParameterTypeDescription
pathStringstringThe relative or absolute path to the target custom function.
_idstring(Optional) ID of the function if calling by database ID.
payloadobjectPayload 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.


Notes

  • Use sdk.utils.absolutePathString() when referencing files relatively.
  • If the call fails, a handled error is shown to the user via UI.
  • Avoid circular calls between functions.
  • This is client-side only—if you're calling server-side methods, use sdk.method instead.