I added a custom field to my forge app using the custom field module in the manifest and also specified a object schema:
enum: ["A1", "A2", "A3", "B1", "B2", "B3", "C1", "C2", "C3"]
I now want to get the allowed values specified via a rest api call.
The most promising I tried was Get custom field configurations
But the response for my custom field does not include the schema:
Call via postman:
Is there a way to get the needed information?
There is no API to fetch the custom field schema defined in the manifest.
What’s your use case, why do you need it?
Thanks for the swift reply.
I have a customFieldEdit component where I need the values of the schema to provide the user with two drop downs:
At the moment I have them hardcoded as arrays, like so:
const riskValues = ["A1", "A2", "A3", "B1", "B2", "B3", "C1", "C2", "C3"];
const complexityValues = ["High", "Medium", "Low"];
These are the same arrays as exist in the manifest. I wanted to remove this code duplication and get these values dynamically, if possible.
In this case, even if there was a REST API for that, I’d say hard-coding the values would be the way to go, because it avoids an extra request that could harm performance of your app. If you are worried about code duplication, I imagine you could incorporate some kind of code generation into your build pipeline that would get those values from the manifest and put them into the code automatically.
Thanks for the suggestion, I had the same idea as a workaround.
I just figured if there is a rest api for that, that would be the easier way to go for me. The api I mentioned made it look like it should be possible to get that information somehow, so I figured I am doing it wrong. At least now I know that I don’t have to spend time searching for something that does not exist.
Thanks for the help!