Results 1 to 3 of 3

Thread: Using API Method to dispaly WorkOrder Item Labor

  1. #1
    Join Date
    May 2007
    Posts
    36

    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

  2. #2
    Join Date
    Aug 2005
    Posts
    186

    Re: Using API Method to dispaly WorkOrder Item Labor

    Quote Originally Posted by MartinParsons View Post
    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 \r\nblah blah blah blah";

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

  3. #3
    Join Date
    May 2007
    Posts
    36

    Re: Using API Method to dispaly WorkOrder Item Labor

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •