Howto set time entry via trigger
Hi all,
I am investigating the option to create time entries in a trigger context.
Problem:
- we want to use the time tracking feature provided by PTC, but we have strict limitations about the data that shall be visible to the users.
Therefore we cannot just enable "time tracking" on our TASK types, as once enabled this would allow all TASK users to review the time entries of their colleagues.
Only dedicated "time admin" users shall be allowed to do this.
Idea:
I created a separate type "TIMESHEET" that has the time tracking enabled and is automatically generated with a 1:1 relationship to the TASK type.
This TIMESHEET type is only visible to "time admin" users.
The TASK users shall enter their hours in a float field "time send today" inside the TASK item.
A pre-event trigger reads that "time spend today" value from a TASKs IssueDeltaBean, and automatically creates an according TimeEntry in the related TIMESHEET item.
The "time spend today" value is cleared from the IssueDeltaBean and all other changes in the TASK may be stored.
Doing so prevents the "time spend today" value from even being part of the TASK's history.
In theory this seems doable, but currently I'm struggling with the trigger framework.
Does anyone know how I can create / edit a time entry from inside a trigger.
So far I only found ways to read time entries.
All replies are welcome

