Developer Q&A

Ask a Question
Back to All

Help with adding a TimeCardItem

Hi,

We are trying to add TimeCardItem to a TimeCard but get error: "TimeCard is a required field"

These are our steps:

  1. We invoke GetTimeCardCommand to get a TimeCard instance.

    Dim tc As New corrigoEnterprise.GetTimeCardCommand()
    tc.BaseDate = "2021-11-20T13:00:00"
    tc.EmployeeId = 50

    Dim resTC As TimeCardActionResponse
    resTC = corrigoService.Execute(tc)

  2. Then we build the TimeCardItem

    Dim tci As New corrigoEnterprise.TimeCardItem
    tci.TimeCard = resTC.TimeCard;
    <... and we complete all required fields of object tci ...>

  3. Finally we execute passing the timeCardItem instance as cmd.entity:

    Dim cmd As New CreateCommand()
    cmd.Entity = itm
    Dim resTCI = corrigoService.Execute(cmd)

  4. We get the following error: "TimeCard is a required field"

Considering that our object could be improperly built, we fetched one TimeCardItem, modified StartDate, EndDate, ConcurrencyId=0, and Id=0, and executed an insert command with this object, totally valid from Corrigo. We am getting the same error: "TimeCard is a required field".

Please help.

Thank you!

Juan