Search code examples
azure-devopstfs-workitem

How to Add additional columns to links page to ExternalLink types


How to add columns to ExternalLink on the "Links" page on Azure DevOps Workitem ?

Answered : Not Possible see answer below

Pull Request is not like Code Review Request, it's not a work item type, we cannot see it from the exported process template. So, I don't think we can customize the columns like the common work item types. – Andy Li-MSFT

after going through the following links link1 link2 and trying the workaround discussed here

I have failed to add more columns to links of the type externallink i have added the following code as described:

         <Page Label="Links" LayoutMode="FirstColumnWide">
          <Section>
            <Group Label="links">
              <Control Type="LinksControl" Name="links">
                <LinksControlOptions>
                  <LinkFilters>
                    <ExternalLinkFilter Type="Build" />
                    <ExternalLinkFilter Type="Integrated in build" />
                    <ExternalLinkFilter Type="Pull Request" />
                    <ExternalLinkFilter Type="Branch" />
                    <ExternalLinkFilter Type="Fixed in Commit" />
                    <ExternalLinkFilter Type="Fixed in Changeset" />
                    <ExternalLinkFilter Type="Source Code File" />
                    <ExternalLinkFilter Type="Found in build" />
                    <ExternalLinkFilter Type="GitHub Pull Request" />
                    <ExternalLinkFilter Type="GitHub Commit" />
                  </LinkFilters>
                  <Columns>
                    <Column Name="System.State" />
                    <Column Name="System.ChangedDate" />
                    <Column Name="System.PullRequest.IsFork" />
                  </Columns>
                </LinksControlOptions>
              </Control>
            </Group>
          </Section>
        </Page>

But the results still show only the original columns. enter image description here


Solution

  • The problem is that the field/column you added (<Column Name="System.PullRequest.IsFork" />) is not a valid work item filed/column. The workaround is only available for work item types due to the columns depend on work item fields.

    You need to add a valid work item field/column here. We can get all the available work item fields by calling the Get Work Item REST API with parameter $expand=Fields added in the URL from a specific work item.

    GET https://{instance}/{collection}/{project}/_apis/wit/workitems/{id}?$expand=Fields&api-version=4.1
    

    For example, the following screenshots shows all the available fields for my Task work item. (It depends on how you defined the fields, if you defined a custom field, you can also see it from the response body.):

    enter image description here

    After that, we can add the columns (System.CreatedBy and Microsoft.VSTS.Common.Priority for example in this sample)

    enter image description here

    Then check the behavior in a Task work item: enter image description here

    Please note that, Pull Requests is not a work item type. We cannot get valid work item fields by calling the Pull Requests REST API. In this case, I don't think we can customize the columns like the common work item types.