i have account Id and put user field but render content is displayed like this below and i got tunnel value is like this format { accountId: '63a9ad1715d69a40aa185fe5' }
Trace ID: 0000000000000000b92121b848cf32e7 There was an error invoking the function - Unexpected child type: object. Valid children are @Forge/ui components, function components, and strings. Error occurred in Text: in CustomField in CustomField in View
Error: Unexpected child type: object. Valid children are @forge/ui components, function components, and strings. Error occurred in Text: in CustomField in CustomField
Hi @john peter -- Welcome to the Atlassian Community!
I recommend posting a question like this one in the developer community:
https://community.developer.atlassian.com/
And when you do make that post, consider providing more context for your question, as it is possible you already have the displayName attribute and that is not visible without describing more of your scenario/application code.
Kind regards,
Bill
import ForgeUI, {useState, useProductContext, CustomField, Text} from "@forge/ui";
import api, { route } from '@forge/api';
export async function setCommentId({fieldKey, issueId, lastAuthor}) {
const url = route`/rest/api/2/app/field/${fieldKey}/value`;
var bodyData = `{
"updates": [
{
"issueIds": [ ${issueId} ],
"value":{"accountId":"${lastAuthor}"}
}
]
}`;
const response = await api.asApp().requestJira(url, {
method: 'PUT',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: bodyData
});
}
export const commentTtl = async (issueKey) => {
const response = await api.asApp().requestJira(route`/rest/api/3/issue/${issueKey}/comment`);
const data = await response.json();
return data.comments;
};
export const View = () => {
const context = useProductContext();
const issueId = context.platformContext.issueId
const fieldKey = context.extensionContext.fieldId
const [cmtAuthor] = useState(async() => await commentTtl(context.platformContext.issueKey));
console.log(cmtAuthor);
const ltAr = cmtAuthor.length-1;
const lastAuthor = cmtAuthor[ltAr]?.author?.accountId;
//console.log(lastAuthor);
if(lastAuthor){
setCommentId({lastAuthor, issueId, fieldKey})
console.log(lastAuthor, issueId, fieldKey);
}
const {extensionContext: {fieldValue}} = useProductContext();
console.log(fieldValue);
return(
<CustomField>
<Text>{}</Text>
</CustomField>
);
};
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.