Last Update: 6/21/2017

Work Item Form Navigation Service

This API is in private preview and subject to change.

The work item form navigation service allows you to open the work item form for a new or existing work item. You can use the service to open a work item form with an initial set of field values pre-populated.

Example

    VSS.require(["TFS/WorkItemTracking/Services"], function(workItemServices) {
        workItemServices.WorkItemFormNavigationService.getService().then(function (workItemNavSvc) {
            workItemNavSvc.openWorkItem(1);
        });
    });

See a full example in the work-item-form sample extension found in the vsts-extension-samples repository.

Methods

openWorkItem()

Opens the specified work item. The host page will display the work item in a dialog.

Syntax

 IPromise<WorkItem> openWorkItem(workItemId, openInNewTab)

Parameters

  • workItemId: number. The id of the work item to open.
  • openInNewTab: boolean. Optional. If true, opens the work item in a new tab. Default is false.

Returns

  • IPromise<WorkItem>. A promise that returns a work item when the work item dialog is closed. If openInNewTab is true, the promise will return null.

openNewWorkItem()

Opens a new work item of the specified type. The host page will display the new work item in a dialog.

Syntax

 IPromise<WorkItem> openNewWorkItem(workItemTypeName, initialValues)

Parameters

  • workItemTypeName: string. The name of the work item type to open.
  • initialValues: IDictionaryStringTo. Optional. A dictionary of any initial field values (field reference name to value pairs) to set after opening the new work item.

Returns

  • IPromise<WorkItem>. A promise that returns a work item when the work item dialog is closed. If the workitem was not saved before closing the dialog, the promise will return null