Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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?

0 votes



8 answers

Permanent link
Hi, you could try to use a Wiki type attribute.

0 votes


Permanent link
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?

0 votes


Permanent link
I had an example where I used to return "{{someURL|sometext}}". Can you try that?

0 votes


Permanent link
Hi Ralph. Ufortunately the results is the same :( I tried with on bracket and two brackets. Any other ideas?

0 votes


Permanent link
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}}";         
} }); })();


0 votes

Comments

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


Permanent link
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?

0 votes

Comments

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
Ralph, could you provide your process template for 3.x if you have such one?

0 votes


Permanent link
You need to define the attribute as type Wiki. Only then it will be shown in the way you expected it.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938
× 16
× 12

Question asked: Sep 27 '12, 8:27 a.m.

Question was seen: 6,653 times

Last updated: Jul 01 '13, 11:05 a.m.

Confirmation Cancel Confirm