Custom Workitem with LinksControl?
Hi all,
I have created my own work item type and now I would like to add a field which should be used as a hyperlink (URL) that describes the task. After looking at some documentation & Team Systems it seems like I should the LinksControl - but I can't really figure out how I should do it.
So how can I add a LinksControl with a hyperlink to it? What datatype should I use for the data field - String or PlainText? How do get the LinksControl to know that I want to have a hyperlink (and not one of the other links that are available in the LinksControl when I look at the control in TS)?
So first how do I define this in my work item type?
Also - how do I create an instance and assign values to this link field? Normally the syntaxt should be something like:
<FIELD name="MyLinkField" value="http://url.com"/>
Thanks
Peter
From your description I think that the LinksControl might not work quite the way you expect it to.
The LinksControl is not designed to allow you to add a simple single hyperlink box. Instead it's a much richer control allowing you to link to multiple artifacts (other work items, version control changesets, hyperlinks, test results etc).
There is no FIELD that you need to attach to a form for the LinksControl. There is no specific field type to represent a single hyperlink. Instead all work items implicitly contain a collection of links. You add a LinksControl to manipulate this collection of links
So, to add a Links Control to a form, you might simply put it on a Tab as follows
<Layout> ....
<
TabGroup>
<Tab Label="Links">
<Control Type="LinksControl"/>
</Tab>
...
</TabGroup>....
</Layout>
Hi John,
I understand that the LinksControl may not be the ideal control to use but it seems like that this is the only control that allows you to add a URL link to a work item.
This is what I try to do:
- Create my own work item type that either uses the existing LinksControl (that "all" work items implicitly contain) or I want to add a new one (e.g. on the first tab in the WI editor). Anyway this is not a problem anymore - I can see the LinksControl just fine where I want it.
- The thing is that I am creating my own process so I not only defines my new work item type but I also want to create instances of it (just like in CurrituckTasks.xml). So how do I give the LinksControl an initial value when I create instances of the work item (this is why I talked about FIELDs before). I have no problem assigning the other fields (which in turn is connected to a control) but I can't figure out how to assign an url hyper link to a field that represents the LinksControl.
Hope this clarifies what I mean.
Thanks
Peter
Peter,
I'm not 100% sure I'm answering your question, but I think you're asking how to add links to the initial work items that are created by the Project Creation Wizard.
This is possible in the CurrituckTask.xml file, although I just looked at the Beta 2 extensibility kit documentation and I see that it isn't described in the document. However, the schema for the CurrituckTasks.xml file (WorkItemMethodology.xsd) does contain the right values.
When you define the work item instances in the methodolgy XML file, in addition to defining the initial field contents you can also add initial hyperlinks. After all the <FIELD> definitions, you can add <HYPERLINK /> elements and specify the absolute URL using the "URL" attribute of the element.
The xsd does define another optional boolean attribute "relativePath" to say whether it is an absolute URL or not, but I'm not sure that relativePaths are working in Beta 2.
See this example (I just tried it out on our latest B3 methodology and it works fine - but our schema hasn't changed in this respect since B2, so you should be fine).
<WORKITEMS>
<WI type="Task">
<FIELD refname="System.Title" value="Create Iteration Plan" />
<FIELD refname="System.IterationPath" value="$$PROJECTNAME$$\Iteration 0" />
...
<HYPERLINK URL="http://www.microsoft.com"/>
</WI>
</WORKITEMS>