Skip to content

IssueService::getCustomFields() does not get custom fields #526

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
AlexHowansky opened this issue Feb 6, 2024 · 1 comment
Closed

IssueService::getCustomFields() does not get custom fields #526

AlexHowansky opened this issue Feb 6, 2024 · 1 comment

Comments

@AlexHowansky
Copy link

The method IssueService::getCustomFields() appears to have been cut-and-pasted from the immediate preceding method getPriority(). It takes the wrong arguments, hits the wrong endpoint, and returns the wrong data. It looks like it should be hitting the field endpoint instead:

--- a/src/Issue/IssueService.php
+++ b/src/Issue/IssueService.php
@@ -831,7 +831,7 @@ class IssueService extends \JiraRestApi\JiraClient
      */
     public function getCustomFields(int $priorityId): Priority
     {
-        $ret = $this->exec("priority/$priorityId", null);
+        $ret = $this->exec('field');
 
         $this->log->info('Result='.$ret);

There is likely also a change that needs to be made to the subsequent json_mapper call, but I am not entirely sure what that should look like.

@lesstif
Copy link
Owner

lesstif commented Mar 24, 2024

Hi @AlexHowansky sorry for to late reply.
I've released a new version and you can call this function like below.

$iss = new IssueService();

$paramArray = [
    'startAt' => 1,
    'maxResults' => 50,
    'search' => null,
    'projectIds' => [1, 2, 3],
    'screenIds' => null,
    'types' => null,

    'sortOrder' => null,
    'sortColumn' => null,
    'lastValueUpdate' => null,
];
$customerFieldSearchResult = $iss->getCustomFields($paramArray);

// all custom fields
var_dump($customerFieldSearchResult->values);

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants