How to Change workitem type in workflow

Description
lofty77
Posts: 1
Joined: Wed Jul 11, 2018 5:06 am

How to Change workitem type in workflow

Postby lofty77 » Thu Jul 12, 2018 1:11 am

Hi all,
I met an issue. we want to change some workitems' type (from type ple to crq).
but polarion do not support change multi workitems type at same time.
so i hope to do it in scriptFunction,but i am not familiar with it :?

Can anyone show me the demo about how to change the workitem type ?

thank you very much.

dan7777777
Posts: 13
Joined: Wed May 17, 2017 5:08 pm

Re: How to Change workitem type in workflow

Postby dan7777777 » Thu Aug 02, 2018 1:18 pm

I will give you some code but it is not complete, you will have to fill some holes on your own. Hopefully this puts you in the correct direction:

//get work item list that you want to change
var workItemList;

//get list of all available work item types in project
var wiTypes = ITrackerProject.getWorkItemTypeEnum();

//iterate through wiTypes and find the correct type
var correctWiType;

//iterate through wi list and set them to new type
var workItem = workItemList[i];

transactionService.beginTx();
workItem.setType(correctWiType);
workItem.save();
transactionService.commitTx();

Steitz
Posts: 1
Joined: Mon Aug 13, 2018 9:37 am

Re: How to Change workitem type in workflow

Postby Steitz » Tue Aug 21, 2018 11:39 am

Hi Dan, do you have the complete code for this now by any chance? I tried playing around with it, but couldn't get it to work.


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 9 guests