Users' timesheets can be approved only manually in Tempo Timesheets, but the process can be automated. Some customers write their own script to look for an approval event when a user has submitted their timesheets, and then “auto-approve” their timesheets with the Data Center REST API.
📘 Instructions
-
The timesheet approval event casts an object with the following parameters:
{
id=108,
userKey=beverly,
actorKey=john,
reviewerKey=john,
status=approved,
period=0121,
dateFrom=2021-01-01,
dateTo=2021-01-31,
periodType=BILLING,
periodView=PERIOD,
reason=Great job!,
workedTime=0,
submittedTime=0,
requiredTime=576000,
action=approve
}
2. With the Data Center REST API, you can run this POST http://localhost:8080/rest/tempo-timesheets/4/timesheet-approval
JSON
{
"action": {
"comment": "This is my comment.",
"name": "approve",
"reviewer": {
"key": "jeanDoe"
}
},
"period": {
"dateFrom": "yyyy-MM-dd"
},
"user": {
"key": "johnDoe"
}
}
Customers also use ScriptRunner to achieve this without writing their own script - refer to our KB’s on Event listeners.