so I try to 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 an object. The problem is if I want to make a 'work' object at any day that hasn't been set in PWA using this POST Method,
https://myweb.com/PWA/_api/ProjectServer/TimeSheetPeriods('mytimesheetId')/TimeSheet/Lines('choosenlineId')/Work/Add
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.<ApplyChanges>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.<QueueUpdateTimesheet>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. Does anyone have an idea?
Thank you in advance