Hello,
I'm using the acli in a script to create a work item. I'd like to add the work item to a sprint.
Unfortunately, the sprint command doesn't have and "add-workitem" sub-command.
As a workaround, I thought about updating the custom field corresponding to the Sprint Value on the work item.
I'm using the acli jira workitem edit command, but I can't figure out how to edit a custom field.
I'm trying the --from-json options with the following JSON:
{"issues":["TICKET-6720"],"fields":{"customfield_10122":"8977"}}
And getting the error:
✗ Error: failed to generate JSON
If I remove the "fields" attribute, I get a success.
How can I format this JSON correctly in order to update that custom field?
Thanks.
Perhaps there is a way to get the current Auth Token's value and use the REST API instead?
Is getting the Auth Token's value from the acli tool feasable?
Yep, using the Jira Software Cloud REST API's Move Issues to Sprint and rank endpoint is the answer, but you can't get the OAuth Token (if that is the auth method you're using) back from the ACLI directly and re-use it, so you'd have to use a known Basic Auth token for that request to the REST API (or use OAuth with the REST API)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use this JSON format with --from-json:
{"issues":["TICKET-6720"],"customfield_10122":"8977"}
Run:
acli jira workitem edit --from-json yourfile.json
Ensure the field ID is correct and the JSON is valid.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried that one and it didn't work either.
When I run:
acli jira workitem view TICKET-6720 --json --fields '*all' | jq .fields.customfield_10122 I get:
[
{
"boardId": 313,
"endDate": "2025-12-22T05:00:00.000Z",
"goal": "",
"id": 8977,
"name": "Sprint 🧑🎄",
"startDate": "2025-12-08T17:37:47.574Z",
"state": "active"
}
]
These are all the permutations I've tried:
{"issues":["TICKET-6720"],"fields":{"customfield_10122":"8977"}}{"issues":["TICKET-6720"],"customfield_10122":[
{
"id": 8977
}
]}
{"issues":["TICKET-6720"],"customfield_10122":"8977"}{"issues":["TICKET-6720"],"fields":{"customfield_10122":[{"id":8977,"boardId":313}]}}{"issues":["TICKET-6720"],"fields":{"customfield_10122":[{"id":8977}]}}{"issues":["TICKET-6720"],"customfield_10122":[{"id":8977,"boardId":313}]}{"issues":["TICKET-6720"],"customfield_10122":[{"id":8977}]}{"issues":["TICKET-6720"],"customfield_10122":[
{
"boardId": 313,
"endDate": "2025-12-22T05:00:00.000Z",
"goal": "",
"id": 8977,
"name": "Sprint 🧑🎄",
"startDate": "2025-12-08T17:37:47.574Z",
"state": "active"
}
]}
{"issues":["TICKET-6720"],"customfield_10122":{
"boardId": 313,
"endDate": "2025-12-22T05:00:00.000Z",
"goal": "",
"id": 8977,
"name": "Sprint 🧑🎄",
"startDate": "2025-12-08T17:37:47.574Z",
"state": "active"
}
}
{"issues":["TICKET-6720"],"customfield_10122":[
{
"id": 8977
}
]}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Jeremie Charrier
Currently the ACLI does not have a command to move Work Items into Sprints.
Although it's possible (read as 'dodgy as heck') via the REST API to alter the Sprint field's value (the ID of a Sprint) to move the Work Item into a Sprint, it requires that field to be on the Edit screen and it's not the recommended approach.
The recommended method is to use the Jira Software Cloud REST API's Move Issues to Sprint and rank endpoint to do what you want.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sunny Ape
Thanks for your answer!
it requires that field to be on the Edit screen and it's not the recommended approach
Can you please expand on that? Does it mean I would need to configure something in the Jira UI before being able to update that field through the acli?
The recommended method is to use the Jira Software Cloud REST API's Move Issues to Sprint and rank endpoint to do what you want"
The reason I'm trying to not use the REST API is that it requires an access token, meaning it requires all our developers to create their own token and keep track of them.
I'd much rather use the acli because it supports login with SSO (which we use), so our developers won't need to even think about access tokens.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, using the REST API, when you create or edit a Work Item (WI), any field you want to set a value for must be on the corresponding Create and / or Edit screens, and the Sprint field is usually not; it is usually only on the View screen. You need to 'force' add that field to all the screens.
Once that is done, then directly altering the value (the ID) of the Sprint field when creating or editing a WI can be done via the REST API, but this has caveats and hidden gotchas (that's a very old topic that I won't go into here, but you can Google it), so that's why it's recommended to not do that, but to use the Jira Software Cloud REST API's sprint endpoint to move the Work Item to the Sprint you need.
So, like you, I assumed that if the REST API can do it via the 'dodgy as heck, cheating method' of directly altering the value of the Sprint field, then I could do the same with the ACLI... but everything I tried failed when trying to create a WI in a Sprint or to move an existing WI to a Sprint. I spent HOURS trying everything possible to get it to work, using all the supposed JSON structures the ACLI expected, but I either got a 'failed to generate JSON' error or a 'Number value expected as the Sprint id., The Sprint (id) must be a number' error or other JSON errors.
The documentation for the ACLI is so incomplete and vague on so many topics, such as the 'special magic' JSON format it requires for the jira workitem create or jira workitem edit commands, that's it's still a crap-shoot to get it to work.
At this point in time, I don't know of any way to get the ACLI to create a WI in a sprint or to move an existing WI to a sprint.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the detailed explanation. I'll raise this as a feature request for the ACLI.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.