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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

🍂📹 Apptoberfest demo contest roundup: vote for your favorite demos!

Hi Community! The submissions are in (and listed below) for the 🍻🍂Apptoberfest🍂🍻 Demo Competition and it’s time for you to place your votes for the best: Analytics & reporting app demo ...

78 views 2 11
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