Add cutom field to every screen of Project

Hi there,

what is the best way to add custom field to every screen of specific company-manged project?
When i add custom field just to defaltScreen I am getting error while creating issues, that custom field does not exist on the screen.

PS: if i try to add custom field to every tab of every screen for every project I am of course getting 429 (rate limit).

Thank you

Hi !
Could you please provide more information about that custom field ? Is it custom made or one of the provided solution ?
Also what sort of error is displaying when creating an issue ?
Screenshots could be helpful here ! :slight_smile:

Regards

1 Like

Hi @JarosawWitowski,

thank you for your response.
I will try add all info:

  1. I create custom field:
    METHOD : POST
    URL: .../rest/api/3/field
    BODY:
 {
              "name": "WHVID",
              "description": "Description of custom field...",
              "type": "com.atlassian.jira.plugin.system.customfieldtypes:readonlyfield",
              "searcherKey": "com.atlassian.jira.plugin.system.customfieldtypes:textsearcher"
}

RESPONSE: 201

{
    "id": "customfield_10078",
    "key": "customfield_10078",
    "name": "WHVID",
    "untranslatedName": "WHVID",
    "custom": true,
    "orderable": true,
    "navigable": true,
    "searchable": true,
    "clauseNames": [
        "cf[10078]",
        "WHVID",
        "WHVID[Short text]"
    ],
    "schema": {
        "type": "string",
        "custom": "com.atlassian.jira.plugin.system.customfieldtypes:readonlyfield",
        "customId": 10078
    }
}
  1. They I assign this custom field to Default screen:
    METHOD: POST
    URL: /rest/api/3/screens/addToDefault/customfield_10078
    RESPONSE: 200
    "CREATED"

  2. Try to create issue:
    METHOD: POST
    URL: .../rest/api/3/issue
    BODY:

{
  "fields": {
    "summary": "Main order flow broken",
    "issuetype": {
      "id": "10000"
    },
    "customfield_10078": "CUSTOM VALUE",
    "project": {
      "key": "DA"
    },
    "description": {
      "type": "doc",
      "version": 1,
      "content": [
        {
          "type": "paragraph",
          "content": [
            {
              "text": "Some description...",
              "type": "text"
            }
          ]
        }
      ]
    },
    "priority": {
      "id": "20000"
    }
  }
}

RESPONS: 400

{
    "errorMessages": [],
    "errors": {
        "customfield_10078": "Field 'customfield_10078' cannot be set. It is not on the appropriate screen, or unknown."
    }
}

NOTE:
So I did not find any easy way to add custom field to specifics projects.
My workaround was:

  1. Pull all projects
  2. Get all screens of all projects
  3. Get all tabs of all screens
  4. assign this custom field to all tabs

But this work just with few projects (~3-4), if I need to do it for more projects, or if projects have many screens I will of course get 429 (rate limit).

How can I handle this situation, if I can not predict on which screens will be custom field used?

Thank you

@JarosawWitowski Any update on this?

Thank you

AFAIK this is the only way to add fields to screens.

Unfortunately the only way to do this is very inefficient, I am doing this the same over here.

@AbdullahTayeh thanks for comment, and I hope some Atlassian stuff is gonna suggest some better solution.

@JarosawWitowski any update on this?

The biggest problem is, that I need to do hundreds call to Jira Cloud to add custom field to all tabs.
Ex: if user have just 7 projects (which is very small amount), there is already more than 100 screens by default. Every screen have at least 1 tab. That mean i need to do more than 100 API calls.
Now imagine company with 1000 projects. That is like 14k calls??

So because there is no way to get screens by project id, to be sure cover all possible use case I need to add this custom field to every tab in every screen in every project. So for big company with 1000 projects, how long is gonna take to do all this requests to not get rate limit from Jira Cloud API?
But maybe I am missing something.

I found that response from /rest/api/3/screens contain project key id in the name of screen.

  "name": "S7: Software Development Default Issue Screen"

=> S7 is a project key, so i can filter screens based on this. But if format of response from API will change in future all instances of my app is gonna crush.

Hi @janambroz !

Sorry you had to wait for a reply. Unfortunately, at the moment there is no better method to “bulk” adding custom fields.

Best regards,
Jaroslaw

Hi @JarosawWitowski ,

thank you for your answer.

Can i use this?

I found that response from /rest/api/3/screens contain project key id in the name of screen.

  "name": "S7: Software Development Default Issue Screen"

=> S7 is a project key, so i can filter screens based on this.

btw do you plan to implement endpoint like this? Or can I create a ticket for that?

Or is there some way to get screens by project? Even if it is multiple API calls, the thing is as I mentioned if my user will have 1000 projects but want use just one project in my plugin, i will need to create this custom field in all projects. Any suggestion?

Edit:

Based on this diagram:

There should be way to do something like this:

  1. Get all issues type in Project
  2. Get Issue Type Screen Scheme
  3. Get Screens
  4. Add custom field to screens from step 3.

What do you think?

Thank you

Hi ! @janambroz

S7 is a project key, so i can filter screens based on this.

Thi is unlikely to work. The user can change the names at any time. It is probably a coincidence that it happens to overlap with the project key.

do you plan to implement endpoint like this? Or can I create a ticket for that?

I have no knowledge on this subject. I would suggest creating such a ticket :slight_smile:

There should be way to do something like this

If there are APIs that allow such things then yes. If no method fits the task then also suggest creating a ticket for that.

Best regards,
Jaroslaw

Hi @JarosawWitowski

I think in this case S7 is a key of Project, if customer change name of project, key does not change.

Can you give mi link where i can create this tickets?

Thanks

Hi !

Please set up a ticket here :slight_smile:
FRGE

Best regardes,
Jaroslaw

If anyone has similar problem, please vote for this feature: [FRGE-968] - Ecosystem Jira