Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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.



0 votes


Accepted answer

Permanent link
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

fTeamRepository.contributorManager().fetchContributorByUserId()

to get the user if you just have the ID.
Harish Raj selected this answer as the correct answer

1 vote

Comments

Thanks, Ralph. Any Idea how to set the creator of the attachment and creation date of the attachment in a WI through Java API?


2 other answers

Permanent link
Hi Harish,

I looked into the API and could not find a setter for the creator or the the creation date. It might be impossible to do. I am not sure but I think I remember that I have seen a similar issue with the ClearQuest Synchronizer.

0 votes


Permanent link
 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.

1 vote

Comments

Thanks Carlos, I remember I did change the creator on creation, so that is probably why I did not notice. I also had administration rights.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,926
× 411

Question asked: Aug 08 '12, 2:16 p.m.

Question was seen: 4,993 times

Last updated: Apr 01 '14, 2:46 a.m.

Confirmation Cancel Confirm