A lookup fields is basically the same as a formula field. Here is what one of my lookup fields looks like when I query the schema:
{
name: 'Demo/Lookup',
id: '6fa1fb3f-bd70-49fe-b904-f4136f98f2b8',
type: 'Demo/Database',
rawMeta: {
'ui/object-editor-order': 2,
'formula/lookup?': true,
'fibery/collection?': true,
'fibery/field-reversed-collection?': true,
'fibery/readonly?': true,
'formula/formula?': true,
'formula/formula': {
expression: {
'q/from': [ '667ed2d8-594f-42ab-8f18-1594b03dbf99' ],
'q/select': {
'fibery/id': {
'q/from': [ 'eeec31e0-b1e9-482a-a422-b2fe888547ca' ],
'q/select': {
'fibery/id': [ '386c69d2-f00e-4241-9dc9-8dd1167664a5' ]
},
'q/limit': 'q/no-limit'
}
},
'q/limit': 'q/no-limit'
},
params: {}
},
'history/disabled?': false
},
holderType: 'Demo/Task',
isCollection: true,
isTitle: false,
isId: false,
isPublicId: false,
isReadOnly: true,
isFormula: true,
isFormulaDisabled: false,
formulaDisableReason: null,
formula: {
expression: {
'q/from': [ '667ed2d8-594f-42ab-8f18-1594b03dbf99' ],
'q/select': {
'fibery/id': {
'q/from': [ 'eeec31e0-b1e9-482a-a422-b2fe888547ca' ],
'q/select': { 'fibery/id': [ '386c69d2-f00e-4241-9dc9-8dd1167664a5' ] },
'q/limit': 'q/no-limit'
}
},
'q/limit': 'q/no-limit'
},
params: {}
},
isLookup: true,
hasLinkRule: false,
linkRule: null,
relation: null,
defaultValue: null,
objectEditorOrder: 2,
isRequired: false,
isHidden: false,
isDeleted: false,
disableLinkExistingItems: false,
version: 1438,
typeObject: [Getter],
mixinTypeObject: [Getter],
holderTypeObject: [Getter],
nameParts: [Getter],
title: [Getter]
}
You could potentially create a lookup field, using API calls and a bit of ‘reverse engineering thinking’ (we don’t have documentation, since it’s not really something we want to support).
However, the formula definition utilises the ids of existing fields/relations, so in your case, it is likely to be very challenging, since you would need to query the schema to find the correct ids, after the integration is created.
I might suggest as an alternative, that you create a relation field in your custom integration, and fill in the values based on a query that runs in the integration code.
i.e. if you have these dbs: Project → Feature → Task and you want to lookup the Features’ Tasks in the Project db, just create a relation between Project and Task, and write the code in the integration to populate this with the correct values.