change workitem title

Description
Janez
Posts: 10
Joined: Thu Jul 14, 2016 6:07 am

change workitem title

Postby Janez » Fri Jan 06, 2017 9:50 am

Hi
I am writeing a plugin for polarion and I want to change some parameters of workitem. This parameters are: workitem title, to add approvers and to add some comment to a existing workitem, but nothing is happend :cry:

Code: Select all

String title = "1";
String wiTitle = "2";
String comment = "3";

wi.setTitle(wiTitle);
wi.addAprovee(user);
wi.createComment(com.polarion.core.util.types.Text.plain(comment),title,null);

wi.setResolution(resolution);
wi.performAction(8);
wi.doAutoAssign();
wi.save();


If I create a new workitem, than is ok. But if I want to update some parts, nothing happend.

Can anybody have any idea?

martins
Posts: 181
Joined: Thu Nov 05, 2009 3:24 pm

Re: change workitem title

Postby martins » Thu Feb 16, 2017 1:13 pm

Modification of a workitem must be done in a transaction, therefore you have to write something like

Code: Select all

  $transactionService.beginTx()
  $wi.setTitle("new Title")
  $wi.createComment(com.polarion.core.util.types.Text.plain("your comment text"),"title of your comment",null)
   ...
  $wi.save()
  $transactionService.commitTx()

The code above is Wiki-code - but in a plugin it's the same procedure:
1. begin a new transaction
2. modify the workitem as intented
3. call save method of the workitem
4. close transaction with a commit

Martin


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

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