Create TimeCard Rest Api in Oracle Fusion

If you need to create a timecard in oracle fusion programmatically, you can use the timeRecordEventRequests REST API provided by oracle. You can use this Create TimeCard Rest Api in Oracle Fusion to Create & Update Time Entries as well. Below are sample payloads

https://fusiondomain/hcmRestApi/resources/11.13.18.05/timeRecordEventRequests/

Create Timecard with Projects Rest Api payload

{
   "processMode": "TIME_SAVE",
   "processInline": "Y",
   "timeRecordEvent": [
     {
       "timeRecordId": "",
       "timeRecordVersion": "",
       "startTime": "2021-02-06T09:00:00.000-08:00",
       "stopTime": "2021-02-06T10:00:00.000-08:00",
       "reporterIdType": "PERSONID",
       "reporterId": "300000047742114",
       "assignmentNumber": "",
       "comment": "Time Entry Update Measure",
       "operationType": "ADD",
       "measure": "",
       "timeRecordEventAttribute": [
           {
          "attributeName":"PayrollTimeType",
          "attributeValue":"ZOTL_Regular"
         },
         {
               "attributeName":"PJC_PROJECT_ID",
               "attributeValue":"300000242085788"
            },
        {
               "attributeName": "PJC_PROJECT_UNIT",
               "attributeValue": "300000047370493"
            },
            {
               "attributeName":"PJC_TASK_ID",
               "attributeValue":"100000701128856"
            }
           ,
            {
            "attributeName":"PJC_EXPENDITURE_TYPE_ID",
               "attributeValue":"300000242085430"
            },
            {
            "attributeName":"PJC_BILLABLE_FLAG",
               "attributeValue":"Yes"
            },
{
               "attributeName":"PJC_SYSTEM_LINKAGE_FUNCTION",
               "attributeValue":"OT"
            }
       ]
     }
   ]
 }

Create Standard Timecard Rest payload

{
"processMode":"TIME_SAVE",
"processInline":"Y",
"timeRecordEvent":
[
{
"timeRecordId":"",
"timeRecordVersion":"",
"startTime":"2017-10-13T10:00:00.000-08:00",
"stopTime":"2017-10-13T14:00:00.000-08:00",
"reporterIdType":"PERSON",
"reporterId":"300000047742114",
"assignmentNumber":"",
"comment":"Time Entry Update Measure",
"operationType":"ADD",
"changeReason":"ORA_CA_REASON_MTE_PROC",
"measure":"",
"timeRecordEventAttribute":
[
{
"attributeName":"PayrollTimeType",
"changeReason":"ORA_CA_REASON_MTE_PROC",
"attributeValue":"ZOTL_Regular"
}

]
}
]
}

Update timecard

{
“processMode”:”TIME_SAVE”,
“timeRecordEvent”:
[{
“timeRecordId”:”300100097300834″,
“timeRecordVersion”:”1″,
“startTime”:”2017-05-01T09:00:01.000-08:00″,
“stopTime”:””,
“reporterIdType”:”PERSON”,
“reporterId”:”300000047742114″,
“comment”:”Time Entry UPDATE”,
“operationType”:”UPDATE”,
“measure”:”9″
}]
}

Delete a timecard

{
"timeRecordEvent":
[{
"timeRecordId":"300100097300834",
"timeRecordVersion":"1",
"reporterIdType":"PERSON",
"reporterId":"300100032181530",
"operationType":"DELETE"
}]
}

Get Timecard

https://fusiondomain.com/hcmRestApi/resources/11.13.18.05/timeRecordGroups?finder=filterByPerNumTimeGrp;personNumber=74,startTime=2022-02-13,stopTime=2022-02-16,groupType=Timecard

For UPDATE/DELETE operation, you must provide timeRecordId and latest timeRecordVersion, which are mandatory. To get these two values you need to use below GET url.

  • 1) If finder is “filterByPerNumTimeGrp” then you need to provide personNumber. Ex: https://************oracle.com/hcmRestApi/resources/latest/timeRecords?onlyData=true&finder=filterByPerNumTimeGrp;personNumber=955160008192497,startTime=2019-01-06T08:00:00.000-08:00,stopTime=2019-01-08T17:00:00.000-08:00,groupType=TimeCardEntry
  • 2) If finder is “ filterByPerIdTimeGrp ” then you need to provide personId. Ex: https://**********oracle.com/hcmRestApi/resources/latest/timeRecords?onlyData=true&finder=filterByPerIdTimeGrp;personId=955160008192497,startTime=2019-01-06T08:00:00.000-08:00,stopTime=2019-01-08T17:00:00.000-08:00,groupType=TimeCardEntry

After getting timeRecordId and timeRecordVersion using above url, you can use the same to update/delete those records.

Once you update, the timeRecordVersion would get incremented. Hence, resending the old version will error out. For every update, you need to do a get on timeRecord REST and get the correct version and use that only. Both timeRecordID and timeRecordVersion need to match for updates.

Points to note:

  • if processInline”:”Y” the timecard will be created directly if set to “N” it will be inserted into interface. Then you need to Run ‘Process Imported Time Entries’ Scheduled process to import the timecard.
  • Start time is mandatory
  • If start and stop time is entered the duration is calculated by the difference between the two
  • If only time needs to be entered, just pass start time and measure field
  • When creating projects timecard layout the combination of fields needs to be passed PJC_PROJECT_ID
    PJC_TASK_ID
    PJC_PROJECT_UNIT
    PJC_EXPENDITURE_TYPE_ID
    PJC_EXPENDITURE_TYPE_NAME
    PJC_SYSTEM_LINKAGE_FUNCTION

Important Tables for Oracle hcm time and labour

Some of the important tables are

HXT_TCLAYFLD_DEFNS_B

The table HXT_TCLAYFLD_DEFNS_B table contains the definition of each layout field which can be later associated to a layout set via the configuration screen.

HXT_TM_COL_ATTR_MAP

The table contains the mapping between the data dictionary attribute to the columns of the timecard UI tables. The consistent mapping across timecards ensure timekeeper can pull up multiple timecards in the same table.

HXT_TM_HEADER

This table represents the timecard header available in the Webentry Timecard UI. It will hold all the header level information for the timecard like Timecard Header Comments,User Status, Resource Id, Resrouce Type, etc apart from holding the timecard header level attributes if configured with any.

HXT_TM_MTRX

This is the table which represents the building blocks of a timecard MTRX row. This doesn’t include the additional row attributes.

HXT_TCLAY_B

The table HXT_TCLAY_B table contains the list of all possible timecard layouts to be displayed for workers. Examples are Entry Layout, Review Layout, Calendar Dialog Layout, etc.

Some SQL to fetch timecard data from base tables

select * from HXT_TM_COL_ATTR_MAP order by creation_date desc

select * from HXT_TM_MTRX order by creation_date desc

select * from HXT_TM_MTRX_DLY_ATRS order by creation_Date desc

select * from HXT_TM_MTRX_DLY_ATR_LNKS order by creation_date desc
select * from HXT_TCLAYST_VL order by creation_date desc

You may like

BIP Webservice example

Which table has timecard entries in oracle fusion

HXT_TM_HEADER, HXT_TM_COL_ATTR_MAP .. You need use joins to get the time building block data

Ref: Oracle hcm tables and views

wpsadmin
We will be happy to hear your thoughts

Leave a reply

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock
Cloud Technologies Blog
Logo
Compare items
  • Total (0)
Compare
0
Shopping cart