It's all about the answers!

Ask a question

Vacation workitem generating wrongly for 1 day when created thru code

Mohanraj Palanisamy (611) | asked Oct 16 '14, 8:30 a.m.
edited Oct 17 '14, 5:30 a.m. by Ralph Schoon (63.2k33646)
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();
        // Debug statements of Date.
        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.

One answer

permanent link
Ralph Schoon (63.2k33646) | answered Oct 17 '14, 5:29 a.m.
Please see:

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

Mohanraj Palanisamy commented Oct 17 '14, 5:51 a.m.

Thanks for the link Ralph.

Your answer

Register or 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.