Create Item tracking Lines with web services

Hello,

I’m currently editing the purchase lines from a purchase order. This already works with the web service, but adding item tracking is proving to be tricky.

I’ve created the ItemTrackingLines object with web services:

stdClass Object ( [Key] => 300;UAEAAACHAQAAAAAAA[LotSnAvailable_Rec_x002C_0] => 1
[LotSnAvailable_Rec_x002C_1] => 1
[Expiration_Date] => 0001-01-01
[New_Expiration_Date] => 0001-01-01
[Warranty_Date] => 0001-01-01
[Quantity_Base] => 0
[Qty_to_Handle_Base] => 0
[Qty_to_Invoice_Base] => 0
[Quantity_Handled_Base] => 0
[Quantity_Invoiced_Base] => 0
[Appl_from_Item_Entry] => 0 ) )

After editing and adding other fields like: Lot_No, Item_No, Location_Code, Quantity_Base, Qty_to_Handle_Base, Qty_to_Invoice_Base, Quantity_Handled_Base and Quantity_Invoiced_Base I’m updating the object.

I get the following error:
[SoapFault exception: [a:Microsoft.Dynamics.Nav.Types.Exceptions.NavCSideDataException] Tracking Specification Entry No. ‘1’ does not exist. in …

This is because the Appl_from_Item_Entry field is invalid. Which web service can I use to get the right Item entry number?

Note that the Item is still not received and doesn’t exist in tables like (Item Ledger Entry, Item Entry Relation, …)

Many Thanks

I’d suggest to create a codeunit for updating the Lot No., something like this (some references from Item Journal Line needs to be replaced of course):

CreateReservEntry.SetDates(

0D, 0D);

CreateReservEntry.CreateReservEntryFor(

DATABASE::“Item Journal Line”,

ItemJnlLine.“Entry Type”,

ItemJnlLine.“Journal Template Name”,

ItemJnlLine.“Journal Batch Name”,

0,

ItemJnlLine.“Line No.”,

PurchLine.“Qty. per Unit of Measure”,

1,

‘Serial No.’,

‘[Your lot no.]’);

CreateReservEntry.CreateEntry(

PurchLine.“No.”,

PurchLine.“Variant Code”,

PurchLine.Location Code",

PurchLine.Description,

PurchHeader.“Posting Date”,

PurchHeader.“Document Date”,

0,

2);

Although I wrote this post in the developers section, we don’t have a developers license. Can you suggest a workaround? The hard way is so much more fun.

Thanks in advance