Using API Method to dispaly WorkOrder Item Labor

Hi,

we have a scenario where the service person is asked a series of questions in a report. Have that all written. We then want to create a new workorder item and copy the response into it. This is the bit I am stuck on.

To create teh new labour item I believe that I should use
WorkorderItemLabors.Add;

What I have is:

  Guid gWOItemID=new Guid(DetailReport.GetCurrentColumnValue("ID").ToString());

  //now that we have the Item, now can fetch the workorder from the woitem id
  Workorder w = Workorder.GetWorkorderByRelativeNoMRU(RootObjectTypes.WorkorderItem, gWOItemID);

  //now get the correct workorder item from this workorder
  WorkorderItem wi = w.WorkorderItems[gWOItemID];

then

  wi.WorkorderItemLabors.Add();

which I know is wrong but unsure what I should use !!

Also I do not think there is something to add text into the labor item ??

Thanks for the help,
Marin

Hi Martin you were on the right track:

WorkorderItemLabor lab = wi.Labors.Add(wi);
lab.ServiceDetails =“blah blah blah blah
blah blah blah blah”;

The save the overall workorder to save this new addition, i.e. w.save();

Thanks !! So close but yet so far on my part.