Skip to main content
Answer

Setting the SOLine notes via code is not working

  • February 17, 2025
  • 2 replies
  • 69 views

Hi Everyone,
I’m creating a processing form to process SOLines based on some functionality, a part of the code is to set the Line note for each SOLine. i tried joining the SOLine to Note table on NoteID. and tried a second way to update the Note table on the database:

 

var note = PXSelect<Note,
Where<Note.noteID, Equal<Required<Note.noteID>>>>
.Select(graph, soLine.NoteID)
.FirstOrDefault()?.GetItem<Note>();

var lineNoteText = "...........";

note.NoteText = lineNoteText;

a “Null Object reference” raised for the note variable. so i thought to use the seconde one:

 

PXDatabase.Update<Note>(
new PXDataFieldAssign<Note.noteText>(lineNoteText),
new PXDataFieldRestrict<Note.noteID>(soLine.NoteID)
);

none of them worked…

any thoughts?

Best answer by stephenward03

If you want to work with the notes against a record try using PXNoteAttribute 

PXNoteAttribute.SetNote(graphProjectEntry.RevenueBudget.Cache, item, n.NoteText);

string s = PXNoteAttribute.GetNote(this.Base.Products.Cache, cROpportunityProduct);

Cheers
Steve

2 replies

Forum|alt.badge.img+1
  • Varsity III
  • Answer
  • February 17, 2025

If you want to work with the notes against a record try using PXNoteAttribute 

PXNoteAttribute.SetNote(graphProjectEntry.RevenueBudget.Cache, item, n.NoteText);

string s = PXNoteAttribute.GetNote(this.Base.Products.Cache, cROpportunityProduct);

Cheers
Steve


  • Author
  • Jr Varsity I
  • February 17, 2025

@stephenward03 Thank you Steve, i tried it before but i was missing something. you made it!