Hi,
I followed the documentation for Issue Collector and I was able to create a webpage with a button that can now show a Dialog to open a ticket in a specific JIRA project. I am even able to provide Default values for some fields by adding this code:
// ==== default field values ====
fieldValues : {
summary : 'This is the default summary value'
}
And it is pretty sweet.
However I would like to upgrade this feature and to be able to pass values instead of only defining defaults one with "fieldValues".
In a way, this is what I am trying to do:
// ==== we add the code below to set the field values ====
"fieldValues": {
summary : $('#summary').val(),
description : $('#description').val()
}
<body>
<input id="summary" name="summary" type="text" value="" />
<input id="description" name="description" type="text" value="" />
</body>
This is a simplified version of my code, but I think it should shows what I am trying to do.
The problem is that the code $('#summary').val() is not called when we click on the button and trigger the function showCollectorDialog();. So the values I am trying to get from the inputs are never gathered back to the Dialog.
I am at lost to try and find a way to solve this.
Any help is appreciated.
Thank you
I have found how to do it.
I will post here, hopefully this will help someone. Atlassian should update their doc on Issue collector as this is not easy at all to understand.
window.ATL_JQ_PAGE_PROPS = {
"triggerFunction": function(showCollectorDialog) {
//Requries that jQuery is available!
jQuery("#feedback-button").click(function(e) {
e.preventDefault();
//This is the new function you need to add
updateFieldValues();
showCollectorDialog();
}
});
},
// ==== Set the default field values if nothing is shared by the user ====
"fieldValues": {
summary : 'A Summary text',
description : 'The description',
priority : '10004',
}
};
function updateFieldValues()
{
// Using JQuery, go gather your values.
window.ATL_JQ_PAGE_PROPS.fieldValues.fullname = $('#fullname').val();
window.ATL_JQ_PAGE_PROPS.fieldValues.components = $('#components').val();
window.ATL_JQ_PAGE_PROPS.fieldValues.description = $('#description').val();
// Etc...
}
You are my hero. I have been searching for this for hours.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Switch to Jira Cloud with Atlassian University! Explore new navigation, issue views, and Cloud features like team-managed projects and automation. Tailored for Data Center users & admins, these courses ensure a smooth transition. Start your journey today!
Enroll now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.