Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Bug] Custom field display #140

Open
GreenInnovator opened this issue Sep 17, 2024 · 3 comments
Open

[Bug] Custom field display #140

GreenInnovator opened this issue Sep 17, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@GreenInnovator
Copy link

Describe the bug
Custom field (for example $REQUEST TYPE [10010]) not working as expected; displays either empty or a JSON.

To Reproduce
Steps to reproduce the behavior:

query: project = SUP AND statusCategory != Done ORDER BY issuetype DESC, created ASC
columns: -type, key, CREATED, DUE_DATE, $REQUEST TYPE, $10010
limit: 40

image

Expected behavior
Custom field value in cell

@GreenInnovator GreenInnovator added the bug Something isn't working label Sep 17, 2024
@servnk
Copy link

servnk commented Oct 23, 2024

potential fix can be to return JSON.stringify(value.value) in renderCustomField function

function renderCustomField(issue, customField) {
  if (!Number(customField)) {
    customField = issue.account.cache.customFieldsNameToId[customField];
  }
  const value = issue.fields[`customfield_${customField}`];
  if (typeof value === "string" || typeof value === "number") {
    return value.toString();
  }
  return JSON.stringify(value.value);
}

@GreenInnovator
Copy link
Author

Trying to access JSON.stringify(value.value) in the renderCustomField function like this:

return JSON.stringify(value.requestType)

results somehow in:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'requestType')
at renderCustomField (plugin:obsidian-jira-issue:11709:21)
at renderTableColumn (plugin:obsidian-jira-issue:11616:32)
at renderSearchResultsTableBody (plugin:obsidian-jira-issue:11759:11)
at renderSearchResultsTable (plugin:obsidian-jira-issue:11725:9)
at renderSearchResults (plugin:obsidian-jira-issue:11719:11)
at eval (plugin:obsidian-jira-issue:11819:9)

JSON.stringify(value):

{
    "_links": {
        "jiraRest": "https://limgroup.atlassian.net/rest/api/2/issue/11190",
        "web": "https://limgroup.atlassian.net/servicedesk/customer/portal/1/SUP-22",
        "self": "https://limgroup.atlassian.net/rest/servicedeskapi/request/11190",
        "agent": "https://limgroup.atlassian.net/browse/SUP-22"
    },
    "requestType": {
        "_expands": [
            "field"
        ],
        "id": "6",
        "_links": {
            "self": "https://limgroup.atlassian.net/rest/servicedeskapi/servicedesk/1/requesttype/6"
        },
        "name": "Request a \"Kiemtoets\" analysis",
        "description": "Aanvraag",
        "issueTypeId": "10036",
        "serviceDeskId": "1",
        "portalId": "1",
        "groupIds": [
            "1"
        ],
        "icon": {
            "id": "10511",
            "_links": {
                "iconUrls": {
                    "48x48": "https://limgroup.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10511?size=large",
                    "24x24": "https://limgroup.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10511?size=small",
                    "16x16": "https://limgroup.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10511?size=xsmall",
                    "32x32": "https://limgroup.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10511?size=medium"
                }
            }
        }
    },
    "currentStatus": {
        "status": "To Do",
        "statusCategory": "NEW",
        "statusDate": {
            "iso8601": "2024-10-08T11:52:13+0200",
            "jira": "2024-10-08T10:52:13.904+0100",
            "friendly": "08-10-2024 11:52",
            "epochMillis": 1728381133904
        }
    }
}

@uztnus
Copy link

uztnus commented Jan 8, 2025

I'm having similar issue when trying to display sprint names and instead I get a JSON :(
Any way to hack around it? with jsonpath?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants