I am working on a Block that would require the creation of fields of type formula.
Unfortunately unstable_createFieldAsync doesn’t allow that (yet?). I could instead create the fields using another type and then watch the dependencies for each record. But it would be kind of hacky and probably not performant.
Is there another way to create a field?
Correct, unstable_createFieldAsync doesn’t support creating formula fields at the moment, and there is no other programmatic way to create a formula field. You would need the user to create the field manually (though you could provide the formula text for them to copy + paste in to the field).
Would love to hear more details about your use case for creating formula fields in this block. We’re keeping track of requests for extensions to these “metadata writes” APIs and I’ll note down your use case!