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

Accepted Answer
1 vote

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'.

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.

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
Community showcase
Posted 5 hours ago in Featured Groups

Tuesday tips & tricks: What is the Atlassian Community?

It's officially Tuesday, which means it's officially time for another tip to help you better navigate this space we call the Atlassian Community. 😄 I got a great question from community member, Sa...

15 views 0 1
View post

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