Hi, I’m MVP form Poland and I’m looking for help with creating custom controls on TFS 2012 – Web Access.
I’ve created control to Visual Studio and it works. But I don’t know how to achieve the same at Web Access. Especially I don’t know how to create new work item with JavaScript API. Below is the code that I want to translate to JS, Anyone could help me?
var wiType =this.CurrentWorkItem.Project.WorkItemTypes["Historia Pracy"];
WorkItem wi =newWorkItem(wiType);
wi["DevCore.WorkHistory.Employee"] = wi.Store.TeamProjectCollection.AuthorizedIdentity.DisplayName;
wi["DevCore.WorkHistory.Date"] = this.workHistoryDateDateTimePicker.Value;
wi["DevCore.WorkHistory.WorkTime"] = this.workHistoryTimeNumericUpDown.Value;
wi["DevCore.WorkHistory.Description"] = this.commentsTextBox.Text;
wi["System.AreaPath"] = this.CurrentWorkItem["System.AreaPath"];
wi.Save();
if(wi.Store.WorkItemLinkTypes.Contains("DevCore.Links.WorkHistory"))
{
var linkType = wi.Store.WorkItemLinkTypes["DevCore.Links.WorkHistory"];
var linkTypeEnd = wi.Store.WorkItemLinkTypes.LinkTypeEnds[linkType.ForwardEnd.Name];
this.CurrentWorkItem.Links.Add(newRelatedLink(linkTypeEnd, wi.Id));
}
this.CurrentWorkItem.Save();