From a custom field - call requestJira?

I’ve got a CustomField going but would like to restrict the access to the content depending on who the user is. Whenever I look at requestJira from the custom field - things go wrong.

Simply executing

await(await api.asApp().requestJira('/rest/api/3/user?expand=groups&accountId='+productContext.accountId) ).json();

causes the CustomFieldEdit view to throw an error of:

Unexpected child type: object. Valid children are @forge/ui components, function components, and strings.

My challenge is I don’t know what the object is - I’m not returning anything at that point… :frowning:

Any pointers? (Or any hidden api’s of where I can go and fetch a user’s groups…)


Could you show your custom field rendering function? From one line alone it’s hard to say what’s going on exactly. I can only assume it’s the only line you have? In that case the error is expected: your function is supposed to return a UI Kit component, not returning anything will be an error.

For how to execute REST APIs in the rendering function, see here: Access the whole entity property object from a Forge Jira custom field rendering function - #3 by mskrzypkowski.