Dashboard Widget – trying to get a sample widget to work of work item feed

Hey,

due to there not being a native matrix-style report for work items, I decided to give it a shot myself, and am currently in the youtrack demo app project. I got so far that the widget gets displayed and I can fetch the workitems from the instance. However, iterating over them, they have no author etc. despite the docs stating they should have some. first I thought the missing query fields were the issue, but with them specified it's throwing heaps of errors.

The logs:

Upload id: 2026_09_27_WKwSXH68SEUeULwmkrjC1v (file: console-export-2026-9-27_20-58-4.log)

This is the code (sorry for my messy typescript. I only know JS so far):

import React, {memo, useCallback} from 'react';
import Button from '@jetbrains/ring-ui-built/components/button/button';
import Heading from "@jetbrains/ring-ui-built/components/heading/heading";

// Register widget in YouTrack. To learn more, see https://www.jetbrains.com/help/youtrack/devportal-apps/apps-host-api.html
const host = await YTApp.register();

// @ts-ignore
let workItems: unknown = []
const fetchWorkItems = async () => {
    try {
        const ytResponse = await host.fetchYouTrack(
            'workItems',
            {
                query: {
                    fields: "author, text, duration"
                }
            }
        );

        console.log(ytResponse);
        // @ts-ignore
        workItems = ytResponse;
    } catch (e) {
        console.error(e);
    }


}
await fetchWorkItems();


const AppComponent: React.FunctionComponent = () => {

    return (
    <div className="widget">
      <Heading>Logged Time Entries</Heading>
      <p>{
          // @ts-ignore
          workItems.length} items found</p>


        {   // @ts-ignore
            workItems.map((item, i) => {
            return (
              <div key={i}>
                  <p>{item.author} logged {item.duration} and left description: {item.text}</p>
              </div>
            )
        }

    )}
      {/*<Button primary onClick={callBackend}>{'Make HTTP Request'}</Button>*/}
    </div>
  );
};


export const App = memo(AppComponent);
0
2 comments
Official comment

Hi!

I'm Sergey from the YouTrack Team. Thanks for reaching out!

The REST API returns only IDs unless you request additional fields. In your request, remove the spaces after commas and specify the properties you need from the nested author and duration objects: fields: 'id,author(name,login),duration(minutes,presentation),text'.

In the widget, render those properties rather than the objects themselves. For example, inside your map callback:

<p key={item.id}>
  {item.author?.name ?? item.author?.login} logged {item.duration?.presentation} and left description: {item.text}
</p>

For a matrix report, use duration.minutes when calculating totals. The Fields Syntax guide explains how to request nested fields, and the Host API reference shows how to pass them to fetchYouTrack().

While we can't troubleshoot custom apps end to end, I hope these changes help. I couldn't access the uploaded console log, so if errors remain, please share the first error message in your reply. That will help us check whether the API request is failing.

Let me know how it goes!

Oh, thanks for the example! I wasn't aware I could nest in the query / field specification. That should get me started!

0

Please sign in to leave a comment.