Add Ledger Note
Posted: Thu Feb 28, 2019 12:18 pm
I am trying to use the API to add a Ledger Note. Using the SDK reference, I have attempted the following:
But as you can see from the comments, the note does not seem to actually get added to the ledger. Please advise!
Thanks.
Code: Select all
private void CreateLedgerNote()
{
dynamic dynamicOrder = this.workingMasterOrder as dynamic;
SelectServer sps = ServiceContext.GetService<SelectServer>();
ILedgersManager lm = sps.GetService<ILedgersManager>();
ILedgerInfo masterOrderLedgerInfo = lm.GetLedgerForOrder(this.workingMasterOrder.Identifier.Guid);
ILedger masterLedger = lm.GetLedger(masterOrderLedgerInfo);
IOrderLedger masterOrderLedger = masterLedger as IOrderLedger;
INote newNote = masterOrderLedger.NewNote(); // have also tried calling this on ILedger masterLedger
newNote.Content = "my ledger note";
masterOrderLedger.Notes.Add(newNote); // does not seem to actually add the note per looking in debugger
lm.ApplyChanges(masterOrderLedger); // this may not be appropriate, maybe just an order save is the answer?
}
Thanks.