MrRefactoring / jira.js

A JavaScript/TypeScript wrapper for the JIRA Cloud, Service Desk and Agile REST API
https://mrrefactoring.github.io/jira.js/
MIT License
366 stars 49 forks source link

Jira Service Desk issue update #251

Closed shadowempire123 closed 1 year ago

shadowempire123 commented 1 year ago

Hi, I am trying to update the description field in an Jira Service Desk project, but it fails.

const issueId = 'ASD-3536'
const client2 = new Version2Client({
    host: process.env.RM_JIRA_URI,
    newErrorHandling: true,
    telemetry: false,
    rejectUnauthorized: false,
    authentication: {
        basic: {
            username: process.env.RM_JIRA_USERNAME,
            password: process.env.RM_JIRA_PASSWORD
        }
    }
})

    let issue_params = {
        fields: {
             description: 'My new description'
        }
    }

    await client2.issues
        .editIssue({ issueIdOrKey: issueId, ...issue_params })
        .then((res) => {
            process.env.NODE_TLS_REJECT_UNAUTHORIZED = 1
        }
        })
        .catch((res) => {
            console.log('error calling client2.issues.editIssue')
            jiraHelper.printErrors(res)
            return 1
        })

I am getting back this error:

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

Is this maybe, because it just is not possible? See https://jira.atlassian.com/browse/JSDSERVER-4609

thx

shadowempire123 commented 1 year ago

any news here?

MrRefactoring commented 1 year ago

Never worked with Service Desk API. No comments here

shadowempire123 commented 1 year ago

Hi, tested it with the Jira API and the update worked.... Any chance to get it working as well in jira.js? image

thx

MrRefactoring commented 1 year ago

Hello @shadowempire123! Do I understand correctly you wanna update Remedy Code with Jira API?

shadowempire123 commented 1 year ago

Yes, it is a custom field

MrRefactoring commented 1 year ago

I think you can put value like here:

let issue_params = {
  fields: {
    customfield_12600: 'needed value' 
  }
};
shadowempire123 commented 1 year ago

That is what I have tried for description (see my example in the top). I understood, updating is not possible via API... I will try again in my other environment and let you know...

MrRefactoring commented 1 year ago

Could you please send me any documentation for API you used in the screenshot? As for me, it should work. And any additional information for creating a similar project on my side will be helpful

shadowempire123 commented 1 year ago

I am currently testing with my ops colleague, at the moment it seems a permission problem. (The screenshot was a test with his user)

shadowempire123 commented 1 year ago

outcome: my jira user had no service desk licence.... 😣 so the update works.

I am still a little confused about this jira ticket... -> https://jira.atlassian.com/browse/JSDSERVER-4609

anyway, thx MrRefactoring for your support and the great jira.js and confluence.js module !