How to import Timesheets through XOG without generating the Timesheet ID?
search cancel

How to import Timesheets through XOG without generating the Timesheet ID?

book

Article ID: 27022

calendar_today

Updated On:

Products

Clarity PPM On Premise

Issue/Introduction

Is it possible to import time into PPM from an external input?

How do I import timesheet through XML Open Gateway (XOG) without having to pre-generate the timesheet internal id numbers? (ie. by running the time period read script).

Environment

Clarity PPM 15.x

Resolution

CA PPM allows Timesheets to be created by importing them into the application without having an existing id.  

There are sample XOG files located in the XOG Client XML folder:

prj_timeperiods_read.xml
prj_timeperiods_write.xml

To allow timesheets to be created via XOG import
 
1. Using XOG, export an open time reporting period for a given resource with an existing timesheet (comment out the 'createTimesheet' filter in the read XOG) to provide a template for import (this will fill out assignment ID, internalTaskID)

2. Update the XOG output file to prepare for XOG write action.

Paste the content of the <TimePeriod> element and its sub-elements into an import ("write") Timeperiod XOG file

    Change the <TimePeriod> start/finish to an active, open timeperiod where the resource has no timesheet.
    On the <TimeSheet> element:
       Add an attribute:  action="add" on the timesheet
       Set the <ID> element to -1
       Set the <version> element to 1
    In any <Actual> elements, change the dates to reflect dates within the chosen time period and set the amounts to the number of hours worked.

3. Perform a XOG read action using the file created in step #2. The timesheet now has an internal ID and a version.

If this XOG write action is run again, a warning is issued that the timesheet already exists for the resource in the designated time period and the timesheet it not imported. 
 
Sample Timesheet XOG write file:  

<?xml version="1.0" encoding="UTF-8"?>
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_timeperiod.xsd">
  <Header action="write" externalSource="NIKU" objectType="timeperiod" version="6.0.11"/>
    <TimePeriods>
        <TimePeriod finish="2015-10-17T00:00:00" openForTimeEntry="true" start="2015-10-17T00:00:00">
            <TimeSheets>
                <TimeSheet action="add" ID="-1"
                    lastModified="2015-10-24T10:10:17"
                    resourceID="PRJ_COVRG_Labor" status="0" version="1">
                    <TimeSheetEntries>
                        <TimeSheetEntry assignmentEstimate="117"
                            assignmentEstimateForTimePeriod="0"
                            assignmentFinish="2015-10-29T17:00:00"
                            assignmentID="5000090"
                            assignmentPendingEstimate="0"
                            assignmentStart="2015-10-18T08:00:00"
                            chargeCodeID="DEV"
                            typeCodeID="VAC"
                            internalTaskID="5000062"
                            projectID="PRJ_COVRG_TRACKED"
                            projectName="PRJ_COVRG_TRACKED"
                            taskID="~rmw" taskName="Effort" totalActuals="8">
                            <DailyActuals>
                                <Actual actualDate="2015-10-11" amount="0"/>
                                <Actual actualDate="2015-10-12" amount="8"/>
                                <Actual actualDate="2015-10-13" amount="0"/>
                                <Actual actualDate="2015-10-14" amount="0"/>
                                <Actual actualDate="2015-10-15" amount="0"/>
                                <Actual actualDate="2015-10-16" amount="0"/>
                                <Actual actualDate="2015-10-17" amount="0"/>
                            </DailyActuals>
                        </TimeSheetEntry>
                    </TimeSheetEntries>
                    <Notes/>
                </TimeSheet>
            </TimeSheets>
        </TimePeriod>
    </TimePeriods>
</NikuDataBus>

Additional Information

The current XOG functionality does not provide a method to make Timesheet 'adjustments'.  The Timesheet XOG functionality only provides for creating or updating Timesheets with a status of 'Open'.