Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

External APi calls to populate custom field

Matthew Thomas
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Oct 20, 2023

I'm creating a new custom module for 

jira:customField:

When i try to use 

import {fetch} from "@forge/api";

 

useEffect(() => {
fetch("XXXXXXXX").then(resp => {
console.info(resp)
})
}, []);


Just as an example to get a list of data from a json endpoint to populate the select list, I don't see this output in the tunnel logs or browser console.

Here is a demo example also not firing

const [test, setTest] = useState([])

useEffect(() => {
fetch("https://myapi.com/resp.json").then(resp => {
setTest([{label: "test", value: "123"}])
})
}, []);

return (
<CustomFieldEdit onSubmit={onSubmit}>
<Select label="Harvest Work Orders" name="harvestworkorders">
{test.map(el => {
return <Option label={el.label} value={el.value} />
})}

</Select>
</CustomFieldEdit>
);


The mainfest file allows this call I've hardcoded a response to set just for testing but still nothing occurs, if I remove the fetch the hardcode works so it seems using fetch doesn't trigger the external api call but I cannot fathom as too why, This seems to work fine if I create a

jira:issueContext


but ideally this would be better as a custom form field but perhaps this is not possible and I will have to go down the other route?

1 answer

1 accepted

0 votes
Answer accepted
Matthew Thomas
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Oct 24, 2023

For anyone else that comes across this I ended up going down the custom field context to pre-populate values. Which is OK for my use case.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events