cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Howto set time entry via trigger

SOLVED
mrump
Alexandrite

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Howto set time entry via trigger

Hi @awalsh

 

Thank you for the response.

I used your idea to write a script that utilizes the "im settimentries" command and the trigger API sessions.

 

It was a bit tricky to get the correct timestamp format for the command, but finally I made it happen.

I works just as expected.  (see attached file if you like)

 

BTW:

What exactly do you mean by  "not certified in the API" ?

View solution in original post

3 REPLIES 3

Re: Howto set time entry via trigger

unfortunately, it's not possible through the trigger beans. And, the im settimeentries command is not certified in the API, though the command may work.

Re: Howto set time entry via trigger

Hi @awalsh

 

Thank you for the response.

I used your idea to write a script that utilizes the "im settimentries" command and the trigger API sessions.

 

It was a bit tricky to get the correct timestamp format for the command, but finally I made it happen.

I works just as expected.  (see attached file if you like)

 

BTW:

What exactly do you mean by  "not certified in the API" ?

View solution in original post

Re: Howto set time entry via trigger

By "not certified in the API", I mean it is not in the list of published commands in the Integrations Builder Guide. 

From the guide:

"Every command and command option on the Integrity Lifecycle Manager and Integrity Lifecycle Manager server can be called through the Integrity Lifecycle Manager API. However, PTC supports only published commands for use with the Integrity Lifecycle Manager API."

"Unpublished commands used with the Integrity Lifecycle Manager API do not always return predictable results. Consequently, PTC does not support them."

Announcements