jira cli copy field value with spaces in custom field name

Hi all,

I inherited a situation where JIRA was not set up correctly, and am try to fix it.  One problem was custom fields were created for versioning.   So I am trying to go project by project and for all issues copy "Release Version" to "fixVersions".

After a short investigation, I determined that the cli was the best tool to use.  I am running this command:

./jira.sh --action runFromIssueList --search "project in (DGAGENTMAC)" --common "-a copyFieldValue --issue @issue@ --toIssue @issue@ --field ""Release Version"" --field2 fixVersions --asVersion"

and getting this:

Error: Unexpected argument: Version

I also tried these:

./jira.sh --action runFromIssueList --search "project in (DGAGENTMAC)" --common "-a copyFieldValue --issue @issue@ --toIssue @issue@ --field 'Release Version' --field2 'fixVersions' --asVersion"

Error: Unexpected argument: Version'


./jira.sh --action runFromIssueList --search "project in (DGAGENTMAC)" --common "-a copyFieldValue --issue @issue@ --toIssue @issue@ --field 'customfield_10102' --field2 'fixVersions' --asVersion"

Remote error: Custom field ''customfield_10102'' is not valid.

How do I specify a field with a space in the name with the runFromIssueList cli action?



3 answers

1 accepted

You are on linux or mac, so use the other form of escaping quoting. Something like:

./jira.sh --action runFromIssueList --search "project in (DGAGENTMAC)" --common "-a copyFieldValue --issue @issue@ --field \"Release Version\" --field2 fixVersions --asVersion

If you are on JIRA 7.x, you don't need the --asVersion.

BTW, what version of JIRA are you using? And CLI version?

Thank you for the response.

I have only been using UNIX/Linux for 30+ years, you would think I would have known/tried that lol.  That did work for the spaces.  However if I need to copy from a custom field to a JIRA standard field it does not work.    I get this error with the exact command above:

Custom field 'fixVersions' is not valid.

If fixVersions is used for field it works great.  If I use it for field2 it fails.

I need to copy from the custom field to the standard field.



What version of JIRA and CLI? I know it works here on JIRA 7 and CLI 5.x. It will not work on JIRA release < 6.4.

Bummer.  We are upgrading to 7 later summer.    We are on 6.4.7 and cli 4.4.0    Maybe I will try to upgrade the cli.   Thanks!

After upgrading the plugin to 5.4, it worked!  Thank you!  That is why I love seeing Bob Swift on any add-on I purchase.  Between you and Atlassian,  The best support i ever experienced!!!!

Good. CLI 5.x added REST support for JIRA 6.4 which included expanded copyFieldValue support.

Also one more little problem.   I tried to rename the field have - instead of space and that failed with:

./jira.sh --action runFromIssueList --search "project in (DGSERVER) and createdDate <= 2014-01-01" --common "-a copyFieldValue --issue @issue@ --toIssue @issue@ --field ""Found-in-Release"" --field2 ""affectsVersions"" --asVersion"

Run: -a copyFieldValue --issue DGSERVER-4663 --toIssue DGSERVER-4663 --field Found-in-Release --field2 affectsVersions --asVersion

Remote error: Custom field 'affectsVersions' is not valid.

It did work the other way but --field2 appears to need a custom field and I need it to be a JIRA field either fixVersions or affectsVersions.  The other way does not work as all it did was wipe out "Found in Release".  (Was on the sandbox so nothing serious just need a way to copy fields)

anyone encounter the error with server and password?

Error: Parameter 'server' is required.
Error: Parameter 'password' is required.


I try the solution as suggested here but it can't help


Yes, what I did is to edit the jira.sh and put the server and password parameters in there as not to share those.  

--server https://myjiraserver.mydomain.com:8090 --user MyUser --password 'MyPassword' 

The server is the URL for your Jira site.  And then a user and password that you wish to log into with.  I have changed mine above as they are confiendtial info....

Thanks for your reply.

Could you please clarify the part 'edit the jira.sh'?

I've tried adding the server, user and password but never touch that jira.sh 

Ignore the "edit the jira.sh"  That is a personal preference just add the arguments on the command line.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Wednesday in Jira

Make your Atlassian Cloud products more secure: our NEW admin security guide

Hey admins! I’m Dave, Principal Product Manager here at Atlassian working on our cloud platform and security products. Cloud security is a moving target. As you adopt more products, employees consta...

248 views 0 6
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