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

Vacation workitem generating wrongly for 1 day when created thru code

On Writing automation code to adding  absence workitem(  Scheduled absence workitem). If the code  has start date and end date as same, It is creating absence workitem for the previous date included.
For example: if i want to create workitem for Oct 22nd then the workitem created for 21-22 which is not right.
I have added the debug line for date before  passed it to the function  and it shows the proper value
Code snippet of schedule work item getting created.
----
IResourcePlanningClient resourcePlanningClient = (IResourcePlanningClient)iTeamRepo.getClientLibrary(IResourcePlanningClient.class);
        ContributorAbsence absence= (ContributorAbsence)IContributorAbsence.ITEM_TYPE.createItem();
        absence.setSummary(type.name());
        absence.setStartDate(startDate);   
        absence.setEndDate(endDate);
        absence.setContributor(engineer);
        // Debug statements of Date.
        System.out.println(absence.getStartDate()+"---"+absence.getEndDate());
        try {
            //
        resourcePlanningClient.saveAbsences(new ContributorAbsence[] { absence }, new NullProgressMonitor());
}
--
>> On the completion of code execution, We are able to see workitem for mentioned date and the previous one.
-----
Your help is much appreciated.

0 votes



One answer

Permanent link
Please see: https://rsjazz.wordpress.com/2014/07/22/manage-scheduled-absences-using-the-plainjava-client-libraries/

If the start date and the end date are the same you should have one day of absence.

0 votes

Comments

Thanks for the link Ralph.

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,927
× 411

Question asked: Oct 16 '14, 8:30 a.m.

Question was seen: 4,354 times

Last updated: Oct 17 '14, 5:51 a.m.

Confirmation Cancel Confirm