It's all about the answers!

Ask a question

How can I set a workitem resolution date using plain Java API?


Andy Jewell (24225068) | asked Apr 29 '15, 7:34 p.m.
I thought I was all set because the work item in the API has a getResolutionDate() method.  Unfortunately, it doesn't have a setResolutionDate()... !

I had been working in the weeds with the API last year but now it's been a while and I'm pretty fuzzy on it.  I thought I'd ask for guidance before digging in again.  Would I be using the generic setAttribute method, find the attribute ID of the resolution date field and set it that way?

Thanks!

Andy

Accepted answer


permanent link
Ralph Schoon (55.6k23642) | answered Apr 30 '15, 1:45 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
The Resolution Date shows up with the ID resolutionDate (type Timestamp) in the process template/Work Item customization. It can be set like any other attribute as far as I am aware. Find the code to work with Timestamp type attributes in the work item commandline: A RTC WorkItem Command Line Version 2.2.
Andy Jewell selected this answer as the correct answer

Comments
Andy Jewell commented Apr 30 '15, 10:55 a.m.

Wow, that is VERY cool!  I learned just about everything I know about RTC API from your posts but somehow never ran across WCL.  Thank you so much!


1
Ralph Schoon commented Apr 30 '15, 11:17 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

It is pretty recent, when I found time to pull all my code together. I have tested it as good as I could. I am waiting for feedback and will try to address issues, if they come up.

One other answer



permanent link
Tiago Moura (8387) | answered Apr 29 '15, 9:57 p.m.
edited Apr 29 '15, 9:58 p.m.
Hi Andy,

like you said, you do not have a setResolutionDate, and the reason is quite simple, since this date is filled when you execute an action that resolve the work item.

I'm not sure if you try to set using the generic setAttribute you will be succeed. Once, I had trouble setting the description attribute using the generic method besides the setDescription.

In this case, I think you need to rethink the reason behind of your need. Maybe you actually need to invoke a resolution action via API, or have a custom date that stores a kind of "Secondary Resolution Date".

Best regards!

Comments
sam detweiler commented Apr 29 '15, 10:18 p.m.

I am with Tiago. why do you want to do this?


Andy Jewell commented Apr 30 '15, 10:59 a.m.

OH, I see what you guys are saying.  I think my case is a little special because this particular work item doesn't proceed through the lifecycle in normal terms.  It acts as a proxy record for another internal system we have.  I have code that periodically updates the RTC proxy record (custom work item).  So it wouldn't be accurate for the resolution date to reflect the date the record was closed since that is usually ex-post-facto.  I want to set the record close date to the system of record.  Normally, I would agree with you but I don't think that approach works in this case.


Ralph Schoon commented Apr 30 '15, 11:05 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The code to change the workflow state is also available in my blog, in case you want to rather use a workflow in your proxy work item Andy.


1
Ralph Schoon commented Apr 30 '15, 11:07 a.m. | edited Apr 30 '15, 11:10 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Well, I guess this does not apply in a batched process. But please be aware that if you really resolve the work item later, the attribute might be overwritten.

Your answer


Register or to post your answer.