Hi,
I’m working on a Jira Cloud application using Forge and Custom UI.
As part of the app functionality, I need to create a custom issue type. This new issue type should be available when installing the application.
Any idea how to do it? I know how to create modules and UI components, but this issue type should not depend on any module, but more related to the entire app.
According to the official docs, this is how I should do it:
https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-types/#api-rest-api-2-issuetype-post
But my question is WHERE should I add this call in my app?
Thanks,
Amit
Hi Amit,
I’m looking into this now for you.
Jordan
Thank you @JordanKoukides 
Basically, I need to know if I can run some code when the app gets installed.
Hi @amityahav !
As I understood correctly you want to make a REST call when the app gets installed - that it is not possible. The only ideas which comes to my mind how to achieve it:
- show the warning indicator in your app that the issue type is not available (simple rest call for issue types) and add some button to easily add it (also simple rest call)
- maybe some
jira:adminPage
when the admin could create needed issue type
- my last idea is to use
webtrigger
module and trigger it once the app is loaded for the first time
I hope it would be helpful. 
Of course we will think about introducing feature that you described however for now it is not possible.
2 Likes
Thank you @KamilRichert & @JordanKoukides for your help!
I will definitely check the suggested solutions 
Hi @KamilRichert,
Can you please elaborate on the third option?
As far as I know, web triggers are external to the app, so how can I get the app-first-loaded event?
@amityahav hmm I was thinking about simple useEffect
which will do the trigger and then use https://developer.atlassian.com/platform/forge/runtime-reference/storage-api/ to store that the app is already loaded.
Hi @KamilRichert,
I get the app’s storage part of your solution, but I’m not sure about the useEffect
that should trigger it.
In my app, I have an issuePanel
module that should only be displayed if the user selected the custom issue type that I want to add. I need to create this custom issue type somehow when the app loads. Any idea how?
This is nearly, what worked for me. From App function I call a function which checks if a storage secret called appIsInstalled is not equal to true. If so, we have to install something. We can build all that in another function, which can be called in that case. Else we don’t have to do anything…
Just look at my code. Not nice, but working 
const checkInstallState = async() => {
const installStatus = await storage.getSecret(‘appIsInstalled’);
if (installStatus != true) {
console.log(“We have to init our app.”);
// call the init function here
await storage.setSecret(‘appIsInstalled’, true);
} else {
console.log(“App init has already run. Nothing to do…”);
}
return true;
}
Of course you can use this also to check if certain issue types or schemes are (still) there and re-install them if needed.