Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,293,827
Community Members
 
Community Events
165
Community Groups

Live Field Error as "Live Field not configured for the Project

Hi ,

I have Created a webitem in the issue screen as below 

<web-item name="jiraButton" i18n-name-key="jiraButton.name" key="jiraButton" section="operations-top-level" weight="1">
<description key="jiraButton.description">The jiraButton Plugin</description>
<label key="Create Jira Project"></label>
<link linkId="jira-button-link"/>
<tooltip key="Automatically create a new Jira project with information of the displayed Jira Issue"/>
<conditions type="AND">
<condition class="com.ebmpapst.jira.projectcreator.ProjectVisibleCondition">
<param name="Project-Management">Project Management</param>
</condition>
<condition class="com.ebmpapst.jira.projectcreator.ProjectMemberVisibleCondition">
<param name="Project-members">Projectmembers</param>
</condition>
</conditions>
</web-item>

 

It has related java script file as below 

var baseUrl=window.location.origin;

AJS.$(document).ready(function()
{

AJS.toInit(function () {

AJS.$("#jira-button-link").click(function (eve) {
//eve.preventDefault();

getFunction();
});
});

});

function getFunction()
{
AJS.$.ajax
({

url: ((baseUrl=='http://localhost:2990')?(baseUrl+'/jira'):(baseUrl)) +'/rest/api/2/issue/'+ encodeURI(JIRA.Issue.getIssueKey()),
type: "GET",
timeout: 0,
dataType: 'json',
processData: false,
headers: {
"Content-Type": "application/json; charset=utf-8"
},

success: function (response)
{
console.log(JSON.stringify(response));
// console.log(JSON.stringify(response.fields.assignee.key));
if(response.fields.assignee == null){
alert("Jira project can't be created. Please assign the issue to an active Jira user!");

}
else{

if (!hasProject(response.key.toString())) {
createProject(response.key.toString(), response.fields.summary, response.fields.assignee.name, ((baseUrl == 'http://localhost:2990') ? (baseUrl + '/jira') : (baseUrl)) + '/browse/' + encodeURI(JIRA.Issue.getIssueKey()));
}


}

console.log(((baseUrl=='http://localhost:2990')?(baseUrl+'/jira'):(baseUrl)) +'/browse/'+encodeURI(JIRA.Issue.getIssueKey()));
},

error: function (response)
{
console.log(response);
}

});
}
//This Project checks whether the project already exist
function hasProject(keyValue) {

keyValue = keyValue.replace("-", "");

AJS.$.ajax
({

url: ((baseUrl=='http://localhost:2990')?(baseUrl+'/jira'):(baseUrl)) +'/rest/api/2/project/' + encodeURI(keyValue) ,
type: "GET",
timeout: 0,
dataType: 'json',
processData: false,
headers: {
"Content-Type": "application/json; charset=utf-8"
},

success: function (response) {
console.log(JSON.stringify(response));
alert("Jira project can't be created. Project already exists!");
return true;
},

error: function (response) {
console.log(response);
// alert("Jira project has error in creating ");
return false;

}
});
}

function createProject(keyValue,summary,lead)
{
var originalKeyValue = keyValue;

keyValue = keyValue.replace("-","");
console.log(keyValue);


summary = summary.trim();
console.log(summary);

AJS.$.ajax
({

url: ((baseUrl=='http://localhost:2990')?(baseUrl+'/jira'):(baseUrl)) +'/rest/project-templates/1.0/createshared/'+
((baseUrl=='http://localhost:2990')?('10000'):('13303')),
type: "POST",
timeout: 0,
dataType: 'json',
processData: false,
headers: {
"Content-Type": "application/json; charset=utf-8"
},
data: JSON.stringify({
"key": keyValue,
"name": originalKeyValue+" "+summary,
"lead": lead,
"projectTypeKey": "business"
}),


success: function (response) {
console.log(JSON.stringify(response));
alert("Jira project has been created. Now you will be navigated to the project summary screen.");
window.location.replace(((baseUrl=='http://localhost:2990')?(baseUrl+'/jira'):(baseUrl)) +'/projects/'+ keyValue +'/summary');
},

error: function (response) {
console.log(response);
}
});
}

 

The webitem works only in the view issue screen 

but it dosnot work in the Project view page as this is related to Live Field configuration

 

Please help me in this case 

 

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

Marketplace Partner Spotlight: AppLiger

This month the spotlight is on AppLiger. We caught up with Pavel Pavlovsky, CEO and Product Manager, to learn how the company started and what fuels the team's creativity.    Atlassian:...

336 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you