Unable to get custom field configuration/allowed values created by forge app

Hello,

I added a custom field to my forge app using the custom field module in the manifest and also specified a object schema:

[...]
schema:
        properties:
          businessRisk:
            type: number
          failureProbability:
            type: number
          functionalComplexity:
            type: number
          risk:
            type: string
            enum: ["A1", "A2", "A3", "B1", "B2", "B3", "C1", "C2", "C3"]
            searchAlias: Risk
[...]

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:

https://danielkleissl.atlassian.net/rest/api/3/app/field/customfield_10041/context/configuration

Response:

{
    "maxResults": 100,
    "startAt": 0,
    "total": 1,
    "isLast": true,
    "values": [
        {
            "id": "10140",
            "fieldContextId": "10140"
        }
    ]
}

Is there a way to get the needed information?

Kind Regards,
Daniel

Hey, @DanielKleissl,

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!