C# SDK convert Order to Invoice

SUGGESTED

Hi,

I can convert Order to Invoice, but  I'm not able to set quantity of the last line. If I set quantity of all the lines but not the last one, the POST will work. If I set quantity on all lines, it will failed on the POST, and an error will appear : An unknown error has occurred. To protect your corporate data, Sage 50 will shut down immediately. Unsaved data will be lost.

This is my code : 

I'm using SDK version 2020.2 

  • 0

    This might not help but there are two issues that are possible.  My first thought is that the rows are zero-based and you are starting with 1 but I just checked and it's the exported csv files that are zero-based.

    So you might have a problem with the Freight lines.  Check to see if the order your are converting has Freight in the Freight field and if so you may have to test for and handle that separately.  The field tsoline.bFreight will tell you if the line is the freight line.

    It may error out because there is no quantity in the columns in titluli but there is a freight row and in titrline there is no freight row but there is a quantity.

  • 0 in reply to Richard S. Ridings

    SetQuantity, line start at 1 in the SDK 


    And salJourn.NumberOfJournalLines give tme the right number of litem line, it doesn't count the the freight line.

  • 0 in reply to Vincent Labbe
    SUGGESTED

    Maybe try the GetBackOrdered method though I would think it should still function.

    Possibly an order doesn't have a quantity on that line (you can leave blank lines or comment lines without quantities and dollars) and you are attempting to assign NULL to the quantity?  Sometimes users add extra rows below and don't realise.  You can see this in the Sales Order lookup to see if any extra rows are in the grid in Sage 50.

    I do not use the SDK myself so I don't know what else to suggest.