Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Cannot initialize a custom field (story points) using REST API, but can via Jira itself

Hi,

I will try to be brief and as accurate as possible:

  • I have an issue in a certain status where - using Jira UI - I can enter story points.
  • I need to be able to do that using REST API. However, that does not work for me and I get the following message: customfield cannot be set. It is not on the appropriate screen, or unknown.

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

2 answers

Hello @PietroR

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.

Hi David,

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.

Hello @PietroR 

The error is giving you the right answer:

  1. Your reference to the field's ID is incorrect, which means you're using the wrong ID somehow.
  2. That field with that ID is not on the EDIT SCREEN, as it must be if you want to edit it.

 

Double check your work:

  1. Create a new issue.
  2. Select 'Edit' then look at the screen... do you see the Story Points field on that screen?
  3. If yes, the field is where it needs to be
  4. Use the REST API Get field endpoint to get the list of all the fields and their endpoints
  5. Find the Story Point field's ID
  6. Use a tool like Postman to check your ability to set the value of that field on that screen using its ID
  7. If yes, then your C# coding is incorrect. Re-read your code to see where you've gone wrong.

Hi David,

as I said, these cannot be the problems, details below:

  • As I said, when editing the issue in the Jira interface, the field is there.
  • The ID of this field is customfield_10106 (which is what I can see when inspecting retrieved data for another story where this field is set):image.png

 

  • The C# SDK takes "fieldName" as a parameter when adding or setting the custom field values, and I can confirm it does work with the name, not ID. All the other actions I work with (reading etc.) use the field name, not the ID - I think it is simply how the SDK is written. But I tried both (x is the reference to the object of the issue I work with):
    • x["customfield_10106"] = "1";
      x["Story Points"] = "1";
      x.CustomFields.Add("customfield_10106", "1" );
      x.CustomFields.Add("Story Points", "1");
      • When using the ID, I get a generic error that the field cannot be found, while when I use the field name, I can see it has been added to the object with the correct ID, but when it gets sent to the server, the message about the inappropriate screen is returned.

Hi Pietro

Well, it sounds like you're very sure that the problem cannot be what I am suggesting it is, so I don't think I can be of any further help.

Have fun working it, and be sure to post the solution here once you've found it.

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.

0 votes
Daniel Ebers Community Leader Jun 05, 2021

Hi @PietroR

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:

  • you could do simplest queries successfully using the C# SDK approach
    • for example getting a list of projects
  • you succeed when doing a short check using Postman (and then to set the value) - basically this is exactly what David was asking

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.

Cheers,
Daniel

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Events near you