It's all about the answers!

Ask a question

How to dispaly value of calculated script in html form in RTC 3.0.1.3?


Krzysztof Kaźmierczyk (7.4k476103) | asked Sep 27 '12, 8:27 a.m.
Hello,
I would like to display the link in RTC. The link address should be calculated based for every link. I have created following script:

(function() {
    dojo.declare("com.example.ValueProvider", null, {
        getValue: function(attribute, workItem, configuration) {
        var value = workItem.getValue("id");
        return "<a href=\"http:\/\/localhost:8080\/test?id=" + value + "\">Update CMT<\/a>";
                }
    });
})();

The value returned by the link is correct but I do not have any idea how to dispaly this link in web ui. If I am setting field to medium html format, the value is encoded. In other words I see entire string:
<a href="http://localhost:8080/test?id=10">Update CMT</a>
instead of "Update CMT" text which is link to http://localhost:8080/test?id=10
Any ideas?

8 answers



permanent link
Ralph Schoon (63.2k33646) | answered Sep 27 '12, 11:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi, you could try to use a Wiki type attribute.

permanent link
Krzysztof Kaźmierczyk (7.4k476103) | answered Sep 28 '12, 8:17 a.m.
Hi Ralph,
I wa s trying with following properties:
return "[[http:\/\/localhost:8080\/test?id=" + value + "]]";
or
return "[http:\/\/localhost:8080\/test?id=" + value + "]";

But in both cases I saw entire string (with [ and ] brackets). Any other ideas?

permanent link
Ralph Schoon (63.2k33646) | answered Sep 28 '12, 8:35 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I had an example where I used to return "{{someURL|sometext}}". Can you try that?

permanent link
Krzysztof Kaźmierczyk (7.4k476103) | answered Oct 01 '12, 7:51 a.m.
Hi Ralph. Ufortunately the results is the same :( I tried with on bracket and two brackets. Any other ideas?


permanent link
Ralph Schoon (63.2k33646) | answered Oct 01 '12, 8:23 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Oct 01 '12, 8:25 a.m.
Have you tried to enter some link you wanted into such an attribute and read the content, to spy at it?

This worked for me (only a link)
/******************************************************************************* * Licensed Materials - Property of IBM * (c) Copyright IBM Corporation 2011. All Rights Reserved. * * TotalCostScriptedCalculatedValue * * Note to U.S. Government Users Restricted Rights: * Use, duplication or disclosure restricted by GSA ADP Schedule * Contract with IBM Corp. * ******************************************************************************/ dojo.provide("com.example.ScriptedDefaultValueProvider"); dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
/** * @see https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Using_scripts_for_attribute_cust
* @see https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_Example
*/
(function() {
    var doDebug = true;     dojo.declare("com.example.ScriptedDefaultValueProvider", null, {
          getValue: function(attribute, workItem, configuration) {             console.log("TotalCostScriptedCalculatedValue - Start");             var workFlowState = workItem.getValue("com.example.attribute.wiki");             console.log("WorkflowState: " + workFlowState);
             return "{{httpas://jazz.net|Jazz.net}}";         
} }); })();



Comments
Ralph Schoon commented Oct 01 '12, 8:31 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

RTC 4.0 but i did this with RTC 3.x as well.


permanent link
Krzysztof Kaźmierczyk (7.4k476103) | answered Oct 02 '12, 7:12 a.m.
Hi Ralph,
Here is what is see in web ui:
{{https://jazz.net|Jazz.net}}

What is the kind of field and presentation you used for that? May it be issue with different presentation type?

Comments
Ralph Schoon commented Oct 02 '12, 7:33 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

As I mentioned above, I used a Wiki type attribute with the Wiki Presentation. I am on 4.0 but I did a similar thing with 3.x, so I don't think that makes a difference.


permanent link
Krzysztof Kaźmierczyk (7.4k476103) | answered Nov 02 '12, 9:13 a.m.
Ralph, could you provide your process template for 3.x if you have such one?

permanent link
Vamsi Vemuri (1) | answered Jul 01 '13, 11:05 a.m.
You need to define the attribute as type Wiki. Only then it will be shown in the way you expected it.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.