Open mirrorgleam opened 5 years ago
Hey.
That command does not have logic for uploading attachments. I will try to reproduce it and see how the functionality can be added
Thanks for getting back to me.
It would be nice to have that feature or be able to bypass the required (but not really required) field. In the mean time I've setup my script to use Invoke-RestMethod to perform the POST method directly to the JIRA server which will create the tickets then I use Add-JiraIssueAttachment within the same foreach loop to attach the files directly after they are created.
When I'm using the Invoke-RestMethod to create the tickets without the attachment field there is no error. I'm thinking the error might be due to a check performed before the POST method is carried out. Perhaps there is a comparison in the New-JiraIssue function that checks to ensure that required fields are all accounted for before attempting to create the ticket and if they're not then it throws an error before attempting to create the ticket?
Perhaps there is a comparison in the New-JiraIssue function that checks to ensure that required fields are all accounted for before attempting to create the ticket and if they're not then it throws an error before attempting to create the ticket?
Yes. it uses Get-JiraIssueCreateMetadata
.
This behavior will only change on v3
Description
I'm trying to create a new JIRA issue with a required field of attachment. No matter how I format it I've been unable to get this to work. The attachment is a required field to create the ticket according to the Get-JiraIssueCreateMetadata output but not when creating a JIRA ticket through the web page. When creating a JIRA ticket manually in the web application "Attachment" will have a red star next to it like any other required field but if you don't add anything it doesn't throw an error and the ticket is created.
There isn't any issue with adding an attachment after the ticket has been created with Add-JiraIssueAttachment but as the attachment is a required field for the tickets I'm trying to create I was hoping to be able to add them as I create the ticket.
The output from Get-JiraIssueCreateMetadata:
Here are a few of the things I've tried and the errors that haunt my working hours.
I didn't try them all at the same time but it was easier to put them in here together.
If I intentionally misspell the field attachment, for error testing purposes, then I get:
New-JiraIssue : Unable to identify field [Attment] from -Fields hashtable. Use Get-JiraField for more information.
If I run New-JiraIssue without the "attachment" field I get the following error:
Then I attempted to run it with the "Attachment filed empty such as:
Attachment = ""
andAttachment = @()
I still get the "Field does not support update 'attachment'" errorI'm able to create tickets using the python JIRA https://pypi.org/project/jira/ by not including the attachment field. If I do include the attachment field I get the same error:
Field does not support update 'attachment'
If there is a way to bypass the "Attachment" fields check that would be good too.
Perhaps I'm just missing something simple. Please help