Jira Command Line Interface does not create issues with custom field even though the user is a project administrator

Through the Jira CLI 2.3.0 version I am trying to create an issue as jira -
a createIssue --project "ADQA" --type "QA Task" --fixVersions "SPP-700" --custom
"Milestones:M01" --components "Feature Testing" --verbose --debug --summary "In
Test"

Milestones is a custom field and the user test has project administration rights. Now, when I run the CLI, it errors out saying

Successful login to: http://dev:8080/rpc/soap/jirasoapservice-v2 b
y user: test
Warning: user is not an administrator. Custom fields cannot be validated. Use co
rrect custom field ids!

Remote error: com.atlassian.jira.rpc.exception.RemoteValidationException: Custom
field ID 'Milestones' is invalid.
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: com.atlassian.jira.rpc.exception.RemoteValidationException: Custom
field ID 'Milestones' is invalid.
faultActor:
faultNode:
faultDetail:
{}com.atlassian.jira.rpc.exception.RemoteValidationException:null

If I give the user jira-administrators permission, then the same create issue goes through fine. Cant a project administrator create issues with custom filed? Do we need to be jira-administrators to do the same?

Attached the exception (CLI.txt)

3 answers

1 accepted

This widget could not be displayed.

Yes, you can create issues with custom fields, but, if you are not an administrator you need to use the custom field id instead of the name. This is because the name must be converted to the id based name and administrator authority is required to retrieve the list of all custom fields so the mapping can be made. So, you need to use something like:

customfield_10100

Note: that on the most recent versions of the CLI, non-administrators can now use custom field names as well as the ids.


Thanks Bob, that worked!!

After trying to create an epic I got this message

Remote error: com.atlassian.jira.rpc.exception.RemoteValidationException: {customfield_10401=Epic Name is required.}

After reading this ticket I tried

--action createIssue  --project AMC --type "epic" --summary "This is CLI test" --customfield_10401 "test" --assignee philippe

but I am still getting Error: Unknown flag 'customfield_10401'.

This widget could not be displayed.

I did include the custom fields but i still got the following error, if i remove the custom fields and try to creae an issue on a different project it seems to work fine...

my $call = $jira->call("jira1.createIssue", $auth, {

'project' => 'XYZ',

'type' => 1,

'summary' => $summary,

'description'=>$description,

'assignee' => $user,

'reporter' => $reporter,

'customfield_10202' => $user,

'customfield_10100' => 'Performance',

'customfield_10004' => 88.067,

java.lang.Exception: com.atlassian.jira.rpc.exception.RemoteValidationException: {customfield_10202=Verifier is required., customfield_10100=Initiative is required., customfield_10004=Found in Build is required.} : [] at openJiraTicket.pl line 40.

You are not using the JCLI, so, your question isn't related to the other question, you should post your own question.

This widget could not be displayed.

Bob, is there something that can be changed at the database level to allow access to the custom field names for non administrators? For us it is a security risk and replacing the custom field names with numbers makes the code much less readable and not portable between our dev and prod system.

Not in the near term, see JCLI-372.

Let me take that back, there is a new API now. Please watch that issue and comment on what version of JIRA you have.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published 12 hours ago in Marketplace Apps

The 7 hacks of highly successful automation

...there's anything I've learnt from working, it's that people are lazy! No offense to anyone reading this, but it's true and we can all admit it. The easier you make something for someone, the more...

60 views 0 8
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you