How to correctly use the parameters in the wiki page?

Description
Anatole
Posts: 3
Joined: Wed Feb 28, 2018 4:01 pm

How to correctly use the parameters in the wiki page?

Postby Anatole » Thu Mar 01, 2018 12:58 pm

Dear community.

I hope you can help me we with the following problem.

During the use of Polarion, I had a problem/difficulty with exporting a document, which is a wiki document. You can see a part of the code below. By setting the required workitem ID, the values of the WI attribute fields will change.

Code: Select all

#set($project = "Name of project")
#set($ID = "TS-XXXX")
#set($workitem = $trackerService.getWorkItem("$project", "$ID"))

<div style="font-weight: bold; text-align: center; font-size:1.5em">Heading:</div>
<br><br>
<span class="bd">Text:</span> $!workitem.getCustomField("crw1")
<br><br>
<span class="bd">Text:</span> $!workitem.getCustomField("crw6")
<br><br>
<span class="bd">Text:</span>
<br><br>
<span class="bd">Text:</span>
<br><br>
$workitem.renderDescription($workitem.getDescription(),null).getContent()
<br><br>
<span class="bd">Text:</span> $!workitem.getCustomField("crw2")
<br><br>
<span class="bd">Text:</span> $!workitem.getCustomField("crw3")
<br><br>
<span class="bd">Text:</span> $!workitem.getCustomField("crw4")
<br><br>
<span class="bd">Text:</span> $!workitem.getCustomField("crw5")


The option with the manual change of the ID workitem in the code structure.. itself is not very convenient. So I tired to add the parameter’s block using the wiki syntax, which would change ID values in the code after entering the desired ID workitem.

Code: Select all

{parameter:Param1|type=string|value=$ID}

{parameter-form}
Param1: {parameter-editor:Param1}
{parameter-form-submit}
{parameter-form-save}
{parameter-form}

#set($project = "Name of project")
#set($ID = $wi.getId())
#set($workitem = $trackerService.getWorkItem("$project", "$ID"))

<div style="font-weight: bold; text-align: center; font-size:1.5em">Heading:</div>
<br><br>
<span class="bd">Text:</span> $!workitem.getCustomField("crw1")
<br><br>
<span class="bd">Text:</span> $!workitem.getCustomField("crw6")
<br><br>
<span class="bd">Text:</span>
<br><br>
<span class="bd">Text:</span>
<br><br>
$workitem.renderDescription($workitem.getDescription(),null).getContent()
<br><br>
<span class="bd">Text:</span> $!workitem.getCustomField("crw2")
<br><br>
<span class="bd">Text:</span> $!workitem.getCustomField("crw3")
<br><br>
<span class="bd">Text:</span> $!workitem.getCustomField("crw4")
<br><br>
<span class="bd">Text:</span> $!workitem.getCustomField("crw5")


Then I have an error message. Maybe I missed something.

There may be more experienced users of the forum, they can share their advice or hint me in resolving this issue.



Best regards

ALMighty
Posts: 71
Joined: Wed Apr 27, 2016 10:34 am
Location: Austria

Re: How to correctly use the parameters in the wiki page?

Postby ALMighty » Fri Mar 02, 2018 2:28 pm

Anatole wrote:Then I have an error message. Maybe I missed something.


Then show us this error message. :D
This would help a lot.

Perhaps the second parameter in the renderDescription() method cannot be null
however it is just a guess since I never used this method to date.
---------------------------------------------------------------------------------------------------
Playing a good game is never lame. :D
Image

Anatole
Posts: 3
Joined: Wed Feb 28, 2018 4:01 pm

Re: How to correctly use the parameters in the wiki page?

Postby Anatole » Mon Mar 05, 2018 11:23 am

Hello ALMightly.
Sorry for the delay with response.

After trying to save the file, this error appears.

ALMighty
Posts: 71
Joined: Wed Apr 27, 2016 10:34 am
Location: Austria

Re: How to correctly use the parameters in the wiki page?

Postby ALMighty » Tue Mar 06, 2018 4:25 pm

Anatole wrote:Hello ALMightly.
Sorry for the delay with response.

After trying to save the file, this error appears.


However you have still not posted the error message.
Just copy the text that appears in this error message into a post here, otherwise it will be a bit though to follow.

I think something will appear in this error message like
Error 0x0843abc: Function could not be executed due to [INSERT REASON HERE]
---------------------------------------------------------------------------------------------------
Playing a good game is never lame. :D
Image

Anatole
Posts: 3
Joined: Wed Feb 28, 2018 4:01 pm

Re: How to correctly use the parameters in the wiki page?

Postby Anatole » Wed Mar 07, 2018 7:33 am

Sorry, it's seems that the attached file failed to be sent :? .

Error in document content.
Error number 4001 in 4: Error while parsing velocity page project/name of project/page/name of workitem/document
Wrapped Exception: Invocation of method 'getCustomField' in class com.polarion.alm.tracker.internal.model.WorkItem threw exception class com.polarion.platform.persistence.UnresolvableObjectException : uri: subterra:data-service:objects:/default/name of project${WorkItem}$ID

ALMighty
Posts: 71
Joined: Wed Apr 27, 2016 10:34 am
Location: Austria

Re: How to correctly use the parameters in the wiki page?

Postby ALMighty » Wed Mar 07, 2018 12:51 pm

Anatole wrote:Wrapped Exception: Invocation of method 'getCustomField' in class com.polarion.alm.tracker.internal.model.WorkItem threw exception class com.polarion.platform.persistence.UnresolvableObjectException : uri: subterra:data-service:objects:/default/name of project${WorkItem}$ID


No clue so far what exactly causes this exception but I have two questions so far concerning your code:

Code: Select all

#set($ID = $wi.getId())


Where is $wi coming from? $wi is nowehre mentioned in the code hence invoking getId() on it returns nothing. Furthermore I have no clue what you want to do with the following:

Code: Select all

<span class="bd">Text:</span> $!workitem.getCustomField("crw6")


This makes no sense to me. As far as I see it, you want to print the values of the custom fields but if you want to print the value of the custom field the code is as follows:

Code: Select all

$workitem.getCustomField("crw6") ## if the field is a Single line text f., int,date
$workitem.getCustomField("crw6").getId() ## if the field is a enumertaion
$workitem.getCustomField("crw6").getContent() ## if the field is multiline text field


For printing a enum custom field or a multiline text custom field, see also methods of the IEnumOption class and Text class.
---------------------------------------------------------------------------------------------------
Playing a good game is never lame. :D
Image


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: Google [Bot] and 2 guests