Please consider implementing the use case you are looking for using a LivePage.
Create WI Servlet
Create a Work Item directly out of wiki pages by passing custom parameters from a wiki page.
It is not possible to call the servlet from outside Polarion as user credentials are taken from existing session.
Tip: Combine this plugin with Workflow Function: Create Baseline to implement a review process.
Create a Work Item to review a module and the contained item. By clicking on the provided hyperlink an item is created.
This item can have a reference to the module (hyperlink) so that the review can find the document he needs to review.
Combine this with custom workflow action: "createBaseline" to freeze a successful review in a baseline.
How to install
1) extract zip into $polarionroot$/polarion folder
2) restart Polarion server
1) create an example wiki page
2) add to wiki page a hyperlink which calls the servlet
Add following example code to the wiki page:
## get the name of the module wiki page
#set ($url = $doc.getURL())
<a href="/polarion/createWI?action=createWI&callerURL=$url&type=task&hyperlink=$url&title=Review of $doc.name
3) click on the hyperlink to create a new workitem
All parameters can be parsed to the servlet via [paramName]=[parmValue].
Parameters are separated via & symbol.
E.g. type=task&title=My title (where type is first parameter and title is second one)
The initial parameter action=createWI is required as he triggers the Work Item creation.
List of parameters:
type - Work Item type to be created (example: type=task)
title - title of created workitem (example: title=This is my new workitem created for $doc.name)
severity - severity of created workitem (example: severity=blocker)
priority - priority of created workitem (example: priority=high)
description - description of created workitem (example: description=this is my description in plain text)
project - project in which workitem should be created (exampe: project=myProject). - required
hyperlink - url to which a hyperlink should be created in workitem (example: hyperlink=http://www.polarion.com)
hyperlinkRole - role of hyperlink which will be created (example: hayperlinkRole=internal)
callerURL - url of page which called the servlet. Request will be forwarded to that page. This should be the URL of the wikipage.
#set ($url = $doc.getURL())
strFieldName = custom string field which can be set (example: strFieldName=fromWikiPage)
strFieldValue = value of custom string field (example: strFieldValue=wikiPageName)
enumFieldName = custom enum field name which can be set (example: enumFieldName=release)
enumFieldValue = value of custom enum field (example: enumFieldValue=Release1_0)
default values for new items can be created in the config file: WEB-INF/config.properties.
If no value is passed to the servlet values of config file will be used.
If parameters are passed to the servlet the default values will be overwritten.
In case of errors the servlet will also return a parameter error=[error message] which could help you to identify the problems.
You can display the error message for debugging in the wiki page in following way:
---- START WIKI SNIPPLET ---
#set( $errorMessage = $request.getParameter("error") )
---- END WIKI SNIPPLET ----
This could happen if you try to access the servlet from outside Polarion (not supported).
or you have lost the session because you are not logged in anymore (just login and tray again)
transaction failed: Could not create workitem
a) Did you provide all necessary parameters ?
b) Did you try to set unsupported fields like boolean, text ...(currently you can only set one custom string and one custom enum field)
some fields are not set in Work Item:
The servlet only supports the fields listed above. So if you wonder why some custom fields are not set please check following:
a) do you have a typoe in the parameter name?
b) do you try to set custom enum or string field or maybe other field type (not supported)?