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?
}
But as you can see from the comments, the note does not seem to actually get added to the ledger. Please advise!
Thanks.
It works for me. (I modified your code slightly - just to make it more readable to others).
For me, when the code runs, the note is added to the order ledger. If I am viewing the order ledger in Select then run the application, the GUI will not be updated automatically. You can keep Select open, but you must close then reload the ledger to see the additional note.