I will try to be brief and as accurate as possible:
But how come? For that very issue I can do that using Jira UI, so why not using REST API?
I tried (with the same results):
x["Story Points"] = "1";
and issue..CustomFields.Add("Story Points", "1" );
I noticed that even when that custom field is present until initialized with a first value, it is not returned in the list of customFields that REST api retrieves.
Thanks a lot
Search this forum for 'not on the appropriate screen, or unknown' for all the times this question has been answered, for all the different reasons why that error would be returned.
Also, your question said you tried "CustomFields.Add("Story Points", "1" );", which looks like some sort of programming language you're using. Your code refers to a field named "Story Points" but you must refer to fields by their ID, not their name, as the Jira Cloud REST API documentation explains. Since the Story Points field is a custom field, you would have to refer to it something like this "CustomFields.Add("customfield_123456", "1" );"
To know what the ID of the Story Points field is, as well as all the other fields, custom or not, query the Get fields endpoint.
I did search and read the other answers but I do not believe this is this case: the field certainly is allowed on the screen because I can do that (for the given story) in Jira UI, but I cannot use the REST API.
I use the C# SDK client.
When I refer to the custom field with its ID ("customfield_XXX), I get "Could not find ...."
Please suggest what I can do, this is really important for us.
PS: Using Jira server in our company.
EDIT: I believe I use it correctly when I call the method with "Story Points" as the fieldName, because then I get this error about the inappropriate screen and the right id (customfield_XXXX) is mentioned there, so apparently the mapping took place. But makes no sense - the issue in a status where I can set the story points in the UI, so there is nothing preventing doing it programmatically using the REST API.
The error is giving you the right answer:
Double check your work:
as I said, these cannot be the problems, details below:
I wish it was, but from what I provided you can see for yourself that this is not the case - I checked and stated results of both your suggestions. It might be a problem in Atlassian C# SDK?
Also is it correct that custom fields with no value set are not returned in the list of custom fields for a given issue? E.g. for a newly created issue with no SPs set, this custom field is not listed unless it has been initialuzed with a value.
the error message "customfield cannot be set. It is not on the appropriate screen, or unknown." seems to be some kind of generic where it should not be - I met this one in a recent case where a authentication issue was involved. Hard to find and also some operations worked - which made things even more complicated... so ... adding to what David said previously:
6. Use a tool like Postman to check your ability to set the value of that field on that screen using its ID
I am wondering if:
Please let Community members know about the outcome. Depending on what you see and experience somebody might be able to give more in-depth advice.
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events