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
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="<b>1.Summary:</b> use a good subject line that is clear and concise.<br/><br/><b>2. Description:</b> Make sure the description contains all steps required to finish the implementation of the User Story and fully describes what is requested.<br/><br/><b>3.Acceptance criteria:</b> 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>