Field is not on appropriate screen or unknown

Hussein Dahash April 28, 2023

I get an error which states that the fields 'summary' and 'description' cannot be set because it is either unknown or not in appropriate screen.

I have seen many topics relating to this issue and I most likely suspect it to be an issue with authorization because I have added both fields to my screen.

My code is:

import {
IHttp,
IModify,
IRead,
} from '@rocket.chat/apps-engine/definition/accessors';
import fetch from 'node-fetch';
import {
ISlashCommand,
SlashCommandContext,
} from '@rocket.chat/apps-engine/definition/slashcommands';

export class n implements ISlashCommand {
public command = 'n';
public i18nParamsExample = '';
public i18nDescription = '';
public providesPreview = false;

public async executor(context: SlashCommandContext, read: IRead, modify: IModify, http: IHttp): Promise<void> {

const supply = {"fields": {"project": {"key": "HUS"},"Summary": "TEST the API","Description": "testing API","issuetype": {"name": "Bug"}}}
const text = "username:password"
const encoded = Buffer.from(text, 'utf8').toString('base64');
const response = await fetch('http://localhost:8080/rest/api/2/issue/', {
method: 'post',
body: JSON.stringify(supply),
headers: {'Content-Type': 'application/json',
'Authorization': 'Basic ' + encoded},
});
const responseText = await response.text();
};
};

Is this how you authorise a request with API or not? 

1 answer

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 28, 2023

Welcome to the Atlassian Community!

This is what you think it is.  If your fields are on an issue-type's edit screen, then you can get a "not on screen / unknown" message when you have not authenticated correctly because you won't be able to see the screen you're trying to use.

Hussein Dahash April 30, 2023

My fields are within the screen I want. I've checked in the settings and they are both available within the screen. 

 

My assumption is that it isn't authenticating the API call, does the API call look correct to you? 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 30, 2023

Your coding language is not familiar to me, I'm sorry. 

I suspect what you do - the authentication, not the application settings.

The authentication part does look ok, but only for systems still enabled for basic authentication (username/password), and I'm not sure that your system still supports that, Atlassian are gradually getting rid of it.

Hussein Dahash April 30, 2023

I see, I'll try another authentication method and see if that fixes the issue or not - Thanks

Hussein Dahash May 2, 2023

@Nic Brough -Adaptavist- ive tried to use the API token method for authorisation (email:api_token) but i am still getting this error,

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

 

For Auth I used this as guide https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-types/#api-rest-api-3-issuetype-post

Any thoughts on how to tackle this?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 2, 2023

I'm afraid it's the same answer - either your authentication is wrong or your create issue screen doesn't have the right fields on it.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.7.0
TAGS
AUG Leaders

Atlassian Community Events