TreeINFO-For-M365 documentation
    Preparing search index...

    Type Alias ExternalLookupCustomFunctionResult

    ExternalLookupCustomFunctionResult:
        | undefined
        | Record<string, unknown>
        | string
        | { request: ExternalLookupRequestOverride }
        | { response: string | object }

    Union of all possible return values from ExternalLookupCustomFunction_<fieldName>.

    The function may be synchronous or async (returning a Promise); the result is always awaited.

    Return value HTTP call Effect
    undefined ✅ yes Request sent with URL from config, no body
    plain object / string ✅ yes Value used as request body (POST)
    { request: ExternalLookupRequestOverride } ✅ yes Overrides URL, headers, body, and/or params
    { response: string | object } ❌ no Data returned directly — see below

    When the function returns { response: ... }, no internal HTTP call is made. The value is passed directly to the result mapping (ResultSetItems / ResultSet). Since the function can be async, this covers two distinct use cases:

    • Static data — return a hardcoded array without any network call at all.
    • Custom async fetch — perform any async operation independently (e.g. fetch a token, call a REST API via tisa.utils.httpRequest, query SharePoint via tisa.sp, obtain an AAD token via tisa.context.aadTokenProviderFactory) and return the assembled result directly, bypassing the lookup's built-in HTTP layer entirely.

    Note: the internal cache (Cache property) is bypassed for direct responses. The custom function owns its own data lifecycle and is responsible for caching if needed.

    • WSAdvancedExample for request override and SOAP examples
    • WSDirectResponseExample for direct response, static data, SharePoint, and AAD examples