[Technical Question] Attempting to pull Tracking Number from Invoice

For a small context, this is a part of a sync application.

I cannot use the macro recorder the Sage 300 has built in to record edits - since the field I am trying to pull seems to be Read Only within the Invoice Entry.

Working:

Currently I am pulling the Invoice Number from Orders.

Not Working:

Trying to pull OE420 Invoice Entry (Tracking No.) by Invoice Number (with the one I got from Orders).

The Invoice Entry has a field "Invoice Entry > Customer > Invoice No." but I cannot retrieve that field?

Code example:

var view = OpenView("OE0420", DBLinkFlags.ReadOnly);

string filter = $"INVNUMBER = '{sageOrder.InvoiceNumber}'";
view.Browse(filter, true);

while (view.Fetch(false))
{
var tracknum = view.Fields.FieldByName("SHIPTRACK").Value as string;
return tracknum ?? string.Empty;
}

return string.Empty;

Code context:

I've tried numerous methods to pull this SHIPTRACK value from Invoice Entries.

Parents
  • 0

    You need to escape those double quotes. That browse filter needs to be $"INVNUMBER = \"{sageOrder.InvoiceNumber}\""; 

    However, you should be able to do something like:

    view.RecordClear();
    view.Order = 6; // this is the key from the roto. Invoice Number.
    view.Fields.FieldByName("INVNUMBER").Value = sageOrder.InvoiceNumber;
    
    return view.Read() 
            ? view.Fields.FieldByName("SHIPTRACK").Value
            : "";

Reply
  • 0

    You need to escape those double quotes. That browse filter needs to be $"INVNUMBER = \"{sageOrder.InvoiceNumber}\""; 

    However, you should be able to do something like:

    view.RecordClear();
    view.Order = 6; // this is the key from the roto. Invoice Number.
    view.Fields.FieldByName("INVNUMBER").Value = sageOrder.InvoiceNumber;
    
    return view.Read() 
            ? view.Fields.FieldByName("SHIPTRACK").Value
            : "";

Children
No Data