Issues loading credit note via sdk where line item needs to be a GL Account item

SUGGESTED

hi There

Looking for some help here on loading a credit note where some lines are inventory items and others need to be loaded as GL Account entries. 

We have been in touch with SAGE sdk support who sent us this:

            //Order detail for stock Line

            OrderDetail OD = new OrderDetail();

            CN.Detail.Add(OD);

            //Vaious Order Detail properties can be added like warehouse , sales reps , userfields etc

            OD.InventoryItem = new InventoryItem("ItemA");//Use the inventoryItem constructor to specify a Item

            OD.Quantity = 10;

            OD.ToProcess = OD.Quantity;

            OD.UnitSellingPrice = 20;

 

            //Order detail for GL Line

            OD = new OrderDetail();

            CN.Detail.Add(OD);

            OD.GLAccount = new GLAccount("Accounting Fees");//Use the GLAccount Item constructor to specify a Account

            OD.Quantity = 1;

            OD.ToProcess = OD.Quantity;

            OD.UnitSellingPrice = 30;

However when we try this we are getting an error to say that the GLAccount line needs to be loaded to an inventory item?

Failed : Inventory document detail record has to be assigned to an inventory document before specifying a general ledger account..

Any idea how to navigate this issue?

  • 0

    Hi Moditar

    Please contact the Evolution SDK Support team directly by sending them your query using the following e-mail address:

    [email protected]

    Kind regards

    Bennie 

  • 0 in reply to Bennie Pienaar

    Hi Bennie

    I have already last week wednesday. Still waiting for a response. thought i would try here and see if i get a better response. 

  • 0 in reply to Moditar

    Hi Moditar

    Please send me a private message with your e-mail address and I'll then ask the SDK Support Team to contact you about this matter.

    Blessings!

    Bennie 

  • 0
    SUGGESTED

    Good day,

    I ended up here at some point while trying to resolve the same issue, and found this question unanswered. I will therefore provide what I believe is a solution, so that whoever ends up here will find at least something that worked for me.

    I resolved the exact same issue by saving the credit note first, then adding the items, as shown below

    CreditNote CN = new CreditNote();
    //assign the various values for the credit note here
    CN.Save();
    
    //Once the thing is saved, I then added the order detail (using the example above it would be as follows:)
    
    OD = new OrderDetail();
    CN.Detail.Add(OD);
    OD.GLAccount = new GLAccount("Accounting Fees");//Use the GLAccount Item constructor to specify a Account
    OD.Quantity = 1;
    OD.ToProcess = OD.Quantity;
    OD.UnitSellingPrice = 30;
    CN.Save();
    String cNoteNumber = CN.process();

    That worked for me, good luck if you stumble across this!

    I think it would be safer to use the account code instead of account description, in case someone changes the description