URLs in custom work item fields of type mediumHtml
I wanted to include a custom work item field that can have a value that is a URL to an external document. I would like the value to be a clickable link in both the RTC client and the browser interface, and of course I'd like it to look right in the browser as well.
I am aware that external URL links can be created in the "links" section of a work item quite easily - and they also get formatted correctly and are clickable in both the RTC client and browser. However I wanted a custom field so that I would be able to search work items easily - I was not sure that this could be done when using the "Related artifacts" link approach. Please correct me if I am wrong though since that would solve my problem a different way.
I'm nearly there, but I can't get a regular URL to appear properly in the web-client.
This is an example of a value I set using the RTC client:
<a>00635,070,724</a>
The problem is that the last part of the URL gets somehow modified in the browser to read:
...OpenForm&.amp.d=00635070724
which causes the query to fail.
Note the "." after the ampersand and "amp". I've tried all the different combinations of "&", "&amp" and quoting of the value in the RTC client and I always seem to get extra "." in the browser links. I am not an HTML expert but have read that the correct way to include an ampersand in a URL was to use "&amp;". As I say, I've tried as many different ways as I can think of to get it to work and failed.
I was also interested to see that even though I set the editor presentation for the field to be "smallHtml" the RTC client didn't display the value as a formatted link - in other words it displayed the HTML source for the link - but recognized it as a link and I am able to click on it.
Any help appreciated!
I am aware that external URL links can be created in the "links" section of a work item quite easily - and they also get formatted correctly and are clickable in both the RTC client and browser. However I wanted a custom field so that I would be able to search work items easily - I was not sure that this could be done when using the "Related artifacts" link approach. Please correct me if I am wrong though since that would solve my problem a different way.
I'm nearly there, but I can't get a regular URL to appear properly in the web-client.
This is an example of a value I set using the RTC client:
<a>00635,070,724</a>
The problem is that the last part of the URL gets somehow modified in the browser to read:
...OpenForm&.amp.d=00635070724
which causes the query to fail.
Note the "." after the ampersand and "amp". I've tried all the different combinations of "&", "&amp" and quoting of the value in the RTC client and I always seem to get extra "." in the browser links. I am not an HTML expert but have read that the correct way to include an ampersand in a URL was to use "&amp;". As I say, I've tried as many different ways as I can think of to get it to work and failed.
I was also interested to see that even though I set the editor presentation for the field to be "smallHtml" the RTC client didn't display the value as a formatted link - in other words it displayed the HTML source for the link - but recognized it as a link and I am able to click on it.
Any help appreciated!
7 answers
Much appreciated Marcel.
Hi all,
I have a similar problem with mediumHtml type formating on RTC2M2.
When creating a new work item with a custom mediumhtml field I get the expected formating "before" I save the workitem:
Field content:
<a href='http://www.google.com'>Googleee</a>
Preview:
Googleee (links to http://www.google.com)
But when I save the work item ... :
Field content:
<a href='http://www.google.com'>Googleee</a>
Preview:
http://www.google.com'>Googleee (links to <server public root URI>/projects/_A)
Is there something I should know about medumHTML type?
Thanks
We are able to add an hypertext link to a custom HTML field simply using:
final String html = "[a href=\"http://example.com\"]website[/a]";(*) Replace [ with <.
wi.setValue(attribute, html);
While the Eclipse client renders the field content in the proper manner (i.e., the word "website" as a link to "example.com"), the web client seems do not allow the HTML injection (i.e., all the content is reported as text).
Any advice?
Thanks in advance.
I have not tried with medium HTML attributes. I used the Wiki type attribute and it seems to work there. An example using JavaScript can be found here in Lab 5 at the end.
Comments
We are still on v2.0.x and the Wiki type attribute seems not to be available (https://jazz.net/library/article/129/).
Sorry, I can't even test that easily anymore, because I got rid of my 2.x installs recently.