Create Work Object in Project Server Timesheet Line using REST API Error

Copper Contributor

Hi so i try build mobile app that consumes project server 2013 REST API. The goal here is to edit each individual line in a certain timesheet, including delete and add object. The problem is if i want to make a 'work' object at anyday that hasn't been set in PWA using this POST Method,

 

"https://myweb.com/PWA/_api/ProjectServer/TimeSheetPeriods('mytimesheetId')/TimeSheet/Lines('choosenl..."

 

with this body,

{ "parameters": { "End":"2020-02-10T23:59:59", "Start":"2020-02-11T00:00:00", "ActualWork": "8h", "Comment": null, "NonBillableWork": "0h", "OvertimeWork": "0h", "PlannedWork": "0h" } }

 

I will get this error message,

 

{ "error": { "code": "42, Microsoft.ProjectServer.PJClientCallableException", "message": { "lang": "en-US", "value": "PJClientCallableException: GeneralUnhandledException\r\nGeneralUnhandledException\r\nException = System.InvalidCastException: Cannot cast DBNull.Value to type 'System.Decimal'. Please use a nullable type.\r\n at System.Data.DataRowExtensions.UnboxT`1.ValueField(Object value)\r\n at Microsoft.Office.Project.Server.BusinessLayer.Timesheet.b__c0(ActualsRow actualsRow)\r\n at Microsoft.Office.Project.Server.Library.PSUtility.Apply[T](IEnumerable`1 enumerable, Action`1 fn)\r\n at Microsoft.Office.Project.Server.BusinessLayer.Timesheet.ApplyChanges(TimesheetDataSet changes)\r\n at Microsoft.Office.Project.Server.BusinessLayer.TimeSheet.UpdateTimesheet(Guid tsUID, TimesheetDataSet timesheetDS)\r\n at Microsoft.Office.Project.Server.BusinessLayer.TimeSheet.QueueUpdateTimesheet(Guid jobUID, Guid tsUID, TimesheetDataSet dsDelta)\r\n at Microsoft.Office.Project.Server.Wcf.Implementation.TimeSheetImpl.<>c__DisplayClass31.b__30()\r\n at Microsoft.Office.Project.Server.Wcf.Implementation.WcfMethodInvocation.InvokeBusinessObjectMethod(String businessObjectName, String methodName, IEnumerable`1 actions)" } } }

 

I think this has something to do with the Project Server 2013 itself since the parameter i input in the body is already as requested by Add() method. Anyone has idea?

 

Thankyou in advance

0 Replies