Skip to content

getWorkItemRelations not working from Org level views #163

@pbcahill

Description

@pbcahill

When using the getWorkItemRelations() method, if the user is currently on an org level page, like the Organization Search page, it returns the following error:

Uncaught (in promise) {stack: 'TypeError: Cannot read properties of undefined (re….min.js:1:7948\n at async Promise.all (index 0)', message: "Cannot read properties of undefined (reading 'id')"

I am calling getWorkItemRelations() in a custom Work Item Control extension. And the issue happens when the work item/extension loads after selecting one of the work items from the search results. Example URL where the issue occurs: https://dev.azure.com/<org>/_search?text=123456&type=workitem

If i navigate to the work item within the actual team project, the getWorkItemRelations() call succeeds as it should.

Example code of how the method is being called"

const workItemFormService = await SDK.getService<IWorkItemFormService>(WorkItemTrackingServiceIds.WorkItemFormService);
getWorkItemRelationships = await workItemFormService.getWorkItemRelations();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions