Post

1 follower Follow
0
Avatar

Is there a way to call this function via API(PHP/SOAP)?

We have an API call that pulls all Timesheet entries for a user between two dates. We use that to calculate Utilization. Basically this:

$Fields = array('ReportedBy', 'Duration', 'WorkItem.ParentProject.PlannedRevenue', 'WorkItem.ParentProject.Name', 'WorkItem.Name');

$clarizenTime = $clarizenAPI->getTimeEntries('Timesheet', $Fields, '', $clarizenUserId, $StartDate, $EndDate);

 

Works fine, but I saw this function in the docs, and I thought I might be pulling too much data and could pare it down some. Can I just call  GetSumOfTimesheetReportHoursForGivenPeriod ? I do need only time that was reported to Projects that have a Expected Revenue (PlannedRevenue) greater than 0.

 

Thanks!

 

Jeff

Marketing Mojo IT Answered

Please sign in to leave a comment.

1 comment

0
Avatar

Hi Jeff.

You cannot call these functions with the API.

You can filter the work items in advance by adding a condition on the Workitem property of the time entry. If you report directly on the Projects, it can be a simple Compare condition with an In operator. If you report on the Project's work items, you can add a nested condition ( i.e. Workitem In  (QueryExpression  with a Where containing (Project In QueryExpression containing the ExpectedRevenue condition)).

Bare in mind that this will internally retrieve all work items of projects/projects that have an expected revenue and then filter Time Entries by them.

A better approach may be retrieving all Time Entries reported by the user in the date range (as you already did), and adding the Workitem.Project.ExpectedRevenue to the result fields. Then you can filter the results easily by testing the ExpectedRevenue field.

Hope this helps.

Ophir

Ophir Kenig 0 votes
Comment actions Permalink