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; } } }); })(); |
3 answers
the summary and description fields are not HTML, so HTML tags won't work.
Comments
Steve Willems
commented Jul 17 '13, 7:41 a.m.
both summary and description are medium and large HTML type attributes |
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..." Should give you : |
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"> |
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.