How to replace the value of the custom field using JQL?

I’m trying to use Replace issue field option API to replace one custom field value with another:

DELETE rest/api/3/field/{fieldKey}/option/{optionId}/issue

The documentation said that I have query options replaceWith and jql to specify changes that I want to apply.



The ID of the option that will replace the currently selected option.

Format:  `int64`



A JQL query that specifies the issues to be updated. For example,  *project=10000*.

So I’m trying to make this request:

const jql = encodeURIComponent(`reporter=${userAccountId}`)

             url: `/rest/api/3/field/${customFieldKey}/option/${oldValue}/issue?replaceWith=${newValue}&jql=${jql}`,
             json: true
}, (error, response, body) => {

    "self": "https://<company>",
    "id": "13704",
    "description": "Remove option 5 from issues matched by 'reporter=5beecbbfe17eda2b3fdd0565', and replace with option 3",
    "status": "RUNNING",
    "submittedBy": 10000,
    "progress": 0,
    "elapsedRuntime": 0,
    "submitted": 1583153547515,
    "started": 1583153547584,
    "lastUpdate": 1583153547584

But unfortunately, even with the correct response, I see no changes in other issues that should be affected by JQL-query. I checked this JQL query with “Search Issues” and it seems fine.

Maybe I misunderstood the goal of this API endpoint?


What’s the response once the task has finished running (changed status from RUNNING to COMPLETE)? Note that the API returns a redirect to the status of the async task that it starts. In the end, the result should show a summary of all issues that were affected and those that couldn’t because of errors.

@kkercz, thank you so much for your response. This information helped me with the debugging process. I believe the issue was in custom field values. Some of the fields showed the same content but in the background, they had different values(no matter why).

The issue is resolved.