I have created a plugin having a project blueprint/template and a web item.
Now, I want the web item to be only visible when someone creates a project using my custom project blueprint/template only i.e. the web item should not be visible when any project is created using any other predefined or existing project templates.
How can I embed the web item to only my project template/blueprint?
Try this Solution
Hi Mohamed,
Could you elaborate the solution in the link provided by you. I am kind of new to Jira development, so, any help would be appreciated.
PFA my code snippet for atlassian-plugin.xml
<project-blueprint key="my-project-template" weight="90">
<label key="my.project.template.name"/>
<projectTypeKey>business</projectTypeKey>
<!--<projectTypeKey>software</projectTypeKey>-->
<description key="my.project.template.description"/>
<longDescription key="my.project.template.description.long"/>
<infoPage soy-template="JIRA.Templates.ProjectTemplates.Tutorial.renderMyProjectTemplateExplanation"/>
<icon location="images/icon.jpg"/>
<backgroundIcon location="images/background.jpg"/>
<add-project>
<hook class="com.example.plugins.tutorial.MyAddProjectHook"/>
<descriptor file="/config/my-project-template-config.json"/>
</add-project>
</project-blueprint>
<web-item name="project-web-item" i18n-name-key="project--web--item.name" key="project--web--item"
section="jira.project.sidebar.plugins.navigation" weight="300">
<description key="project--web--item.description">The project-web-item Plugin</description>
<label key="project--web--item.label"/>
<!--This web item links to a servlet-->
<link linkId="project--web--item-link">/plugins/servlet/issuecrud</link>
<param name="iconClass" value="aui-icon-large icon-sidebar-release"/>
</web-item>
I want the web item above to be only visible when someone creates a project using my project-blueprint only.
------------------------------------
Also, PFA my code for MyAddProjectHook.java for the custom project template/blueprint.
package com.example.plugins.tutorial;
import com.atlassian.jira.project.template.hook.AddProjectHook;
import com.atlassian.jira.project.template.hook.ValidateData;
import com.atlassian.jira.project.template.hook.ValidateResponse;
import com.atlassian.jira.project.template.hook.ConfigureData;
import com.atlassian.jira.project.template.hook.ConfigureResponse;
public class MyAddProjectHook implements AddProjectHook
{
@Override
public ValidateResponse validate(final ValidateData validateData) {
ValidateResponse validateResponse = ValidateResponse.create();
//projectKey
if (validateData.projectName().equals("TEST")) {
validateResponse.addErrorMessage("Invalid Project Name");
}
return validateResponse;
}
@Override
public ConfigureResponse configure(final ConfigureData configureData)
{
return ConfigureResponse.create();
}
}
Regards and thanks in advance!
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.