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

Script based attribute customization: possible to return formatted text?

 Using the Default Value based attributes customization (Script based) I can add a default text in the  descripiton based on the work item type. 
This is working fine, however to make it nicer (as possible with the Multiline text) I would like to add some basic formatting. 

Does anyone have an idea if thisis possible and how?

Thanks a lot

Here's a short example of the js
(function() {
	var instructions= {
		"defect": "<b>1.Summary:</b> Fill in a nice and clear description"
	};
	var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
    dojo.declare("scripts.DefaultDescription", null, {

        getDefaultValue: function(attribute, workItem, configuration) {
			var type = workItem.getValue(WorkItemAttributes.TYPE);
			var instruction = instructions[type];
			if (instruction == null) {
				return "";
			} else {
				return instruction;
			}
			
        }
    });
})();

0 votes



3 answers

Permanent link
the summary and description fields are not HTML, so HTML tags won't work.

0 votes

Comments

both summary and description are medium and  large HTML type attributes


Permanent link
Hi Steve, your idea is fine and to add multiline text in the default value string you can use \n for new line or line breaks. Something like :
var value = "This is the 1st line \n2nd line..."
return value;

Should give you :

0 votes


Permanent link
Thanks, I knew it was possible using new line but it would be nice to use also some bold items for titles/sections in the  description.

When you take a look at what is save in the process description when using a default value (multiline html) this is what you get so I guess somehow it should be possible to send this also back in an understandable format for the description (which is of type multiline HTML) using the script:

<defaultValueProvider id="com.ibm.team.workitem.valueproviders.DEFAULT_VALUE_PROVIDER._X9WL0NdnEeKVVrGT3p2MUA" name="Guidelines User Story" providerId="com.ibm.team.workitem.common.internal.attributeValueProviders.CustomDefaultHTMLProvider">
<value content="&lt;b&gt;1.Summary:&lt;/b&gt; use a good subject line that is clear and concise.&lt;br/&gt;&lt;br/&gt;&lt;b&gt;2. Description:&lt;/b&gt; Make sure the description contains all steps required to finish the implementation of the User Story and fully describes what is requested.&lt;br/&gt;&lt;br/&gt;&lt;b&gt;3.Acceptance criteria:&lt;/b&gt; Make sure to put the conditions on which the story is considered as completed. It is very important here to described what is (or what is not) included so a tester can set it as verified. Typically here you will find also the links towards test cases validating the User Story."/>
</defaultValueProvider>

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
× 6,121

Question asked: Jul 16 '13, 11:44 a.m.

Question was seen: 5,152 times

Last updated: Jul 17 '13, 7:42 a.m.

Confirmation Cancel Confirm