How to set creator of a WI and Attachments in WI through Plain Old Java Client?
Is there a way/method by which we could change the 'Created By' attribute by Plain Old Java Client? I know how can do it by Bugzilla. We have created a tool to upload bulk Attachments for WIs as a part of HP QC to Jazz migration. Though we are able to perform this operation, the creator and created date of the attachment remaining unsuccessful.
so thought of keeping you updated about this to discuss this further.
so thought of keeping you updated about this to discuss this further.
Accepted answer
Hi Harish,
you can use the following built in methods on IWorkitem to set the creator/owner:
IWorkItem workItem = workingCopy.getWorkItem();
workItem.setCreator(contributor);
workItem.setOwner(contributor);
Please see https://rsjazz.wordpress.com/2012/08/02/subscribing-to-a-work-item-using-the-java-api/ how to use
to get the user if you just have the ID.
you can use the following built in methods on IWorkitem to set the creator/owner:
IWorkItem workItem = workingCopy.getWorkItem();
workItem.setCreator(contributor);
workItem.setOwner(contributor);
Please see https://rsjazz.wordpress.com/2012/08/02/subscribing-to-a-work-item-using-the-java-api/ how to use
fTeamRepository.contributorManager().fetchContributorByUserId()
to get the user if you just have the ID.
2 other answers
Hi Harish, Ralph.
This answer might be too late, but here it is for anyone else doing any dev with the java plain API:
The work item methods setCreator() and setCreationDate() will fail if the attribute is readonly at attribute, not editor, level (directly on the Configuration Data > Work Items > Types and Attributes).
They do not throw errors or exceptions so far as I've tested but once an admin removes that readonly flag (unchecks the box) then you can set creator and creation date programmatically.