The customer wants to show the text in a custom field on the grid of the AP301110 Incoming Documents screen. This saves them from having to open the note on each row to inspect the note text.
I add a custom unbound field UsrNote to the grid.
When the screen is loaded or refreshed, it displays the note text properly.
When you open the note and change it to Joe2 and click OK, it saves the note, but the value on the grid is not updated.
I think the goal is to click the Refresh action on the screen after you click OK on the Note popup.
Since this is a processing screen, the persist to the DB happens outside of the events that are firing in the IncomingDocumentsProcess graph, and no events are fired on the graph extension.
After you click OK on the note, no events fire on the graph other than RowSelected. If I try to get the new value saved in the DB on that event, it just brings up the previous notetext value, not the new value.
I am using the FieldSelecting event to get the DB value for the current record and set the custom field to the NoteText value. This works correctly.
What can I do on this graph extension to cause the screen to refresh when the note is saved to the DB? The RowPersisted on Note table is not fired.
I’ve tried hundreds of things to try to catch the update to the Note that was saved but I cannot find any way to do it.
Here is my code at this time. I’ve left off the hundreds of commented out lines that did not work.
public class IncomingDocumentsProcess_Extension : PXGraphExtension<IncomingDocumentsProcess> {
// Only react to inserts or updates if (e.Operation != PXDBOperation.Insert && e.Operation != PXDBOperation.Update) return;
Note updatedNote = e.Row;
// Find the matching grid row in IncomingDocumentsProcess // Note: Check the exact view name in your version (commonly Base.Records) RecognizedRecord matchingRow = Base.Records.Select() .RowCast<RecognizedRecord>() .FirstOrDefault(r => r.NoteID == updatedNote.NoteID);
if (matchingRow != null) { // Your custom logic here (e.g., updating a custom flag or refreshing the grid) Base.Records.Cache.SetValueExt<SCGCRecognizedRecordExt.usrNote>(matchingRow, true); Base.Records.View.RequestRefresh(); } }
//return current value to the custom field in the grid //works properly protected virtual void _(Events.FieldSelecting<RecognizedRecordForProcessing, SCGCRecognizedRecordExt.usrNote> e) { var row = (RecognizedRecordForProcessing)e.Row; if (row == null) return;
//HUNDREDS of lines below here that are commented out
Best answer by Abhishek Niikam
Hi @Joe Schmucker , sorry, I missed your notification!
Here’s what I’ve implemented along with my code. It’s working in both Classic UI and Modern UI.
In the graph extension, use the FieldSelecting event to fetch the latest note text directly from the Note table and assign it to the unbound UsrNote field.
This ensures the grid displays the latest note whenever the field is selected, including after the grid refresh.(I’m, assuming your event already working properly)
ASPX Page Code-Behind (.aspx.cs)
To refresh the unbound UsrNote column immediately after the user saves the note using the built-in Note icon, attach to the grid's NoteSave event in the ASPX page code-behind.
Since the grid is nested inside an ASP.NET MasterPage (ContentPlaceHolder), use recursive FindControl to locate the grid.
Code (.aspx.cs):
using System; using System.Web.UI; using PX.Web.UI;
public partial class Page_TS609090 : PX.Web.UI.PXPage { private bool _hooked = false;
I’ve never done javascript on an ASPX page other than in Classic UI. I honestly don’t know how to do what you recommended for MUI. Is this done in the frontend MUI file? If you could show me the code you used to do your test I would be willing to pay you for it.
Also, thank you SO MUCH for taking the time to actually do this and show it in the video. That was mad fresh!
Hi @Joe Schmucker , sorry, I missed your notification!
Here’s what I’ve implemented along with my code. It’s working in both Classic UI and Modern UI.
In the graph extension, use the FieldSelecting event to fetch the latest note text directly from the Note table and assign it to the unbound UsrNote field.
This ensures the grid displays the latest note whenever the field is selected, including after the grid refresh.(I’m, assuming your event already working properly)
ASPX Page Code-Behind (.aspx.cs)
To refresh the unbound UsrNote column immediately after the user saves the note using the built-in Note icon, attach to the grid's NoteSave event in the ASPX page code-behind.
Since the grid is nested inside an ASP.NET MasterPage (ContentPlaceHolder), use recursive FindControl to locate the grid.
Code (.aspx.cs):
using System; using System.Web.UI; using PX.Web.UI;
public partial class Page_TS609090 : PX.Web.UI.PXPage { private bool _hooked = false;
WOW. That is so over my head. Thank you so much for providing me with your work!
I created a new class file and put that code in it. It does not fire in debug. I changed the code from Page_TS609090 to Page_AP301110 as that is the page I am working on. I thought that might be the issue. That does not fire in debug either.
This is so over my head that I wouldn’t know what to check for. Sorry for being a pain on this.
In my graph extension, I am getting the value to show as follows:
protected virtual void _(Events.FieldSelecting<RecognizedRecordForProcessing, SCGCRecognizedRecordExt.usrNote> e) { var row = (RecognizedRecordForProcessing)e.Row; if (row == null) return;
protected virtual void _(Events.FieldSelecting<Customer, BAccountExt.usrNote> e) { if (e.Row == null) return; var row = e.Row; if (row.NoteID == null) return;
string currentDbNote = null; using (PXDataRecord record = PXDatabase.SelectSingle<Note>( new PXDataField<Note.noteText>(), new PXDataFieldValue<Note.noteID>(row.NoteID))) { if (record != null) { currentDbNote = record.GetString(0); } }
var ext = PXCache<BAccount>.GetExtension<BAccountExt>(row); if (ext != null) ext.UsrNote = currentDbNote; e.ReturnValue = currentDbNote; }
Key point:FieldSelecting fetches the latest note text directly from the database whenever the grid requests the field value. After the ASPX code-behind refreshes the grid, this event runs again and displays the updated note.
Replace BAccountand BAccountExtwith your actual DAC and DAC extension names.
If you're unsure about the ASPX.cs changes, feel free to share your code, and I'll modify it accordingly.
@Abhishek Niikam That code for the fieldselecting works. The original code I had also works. But you have to refresh the page for the change in the note to show with either yours or mine.
I cannot hit debug in the public partial class Page_TS609090 : PX.Web.UI.PXPage cs file. I’ve set a breakpoint in every method, none of them are hit.
I tried resetting caches, restarting the application and setting compilepages to true in web config.
Edit...If I put a breakpoint in the base AP301110.aspx.cs file, it hits it. For some reason, it seems like my partial class is not being added to the process.
I think I might just tell the customer to hit refresh after they enter a note.
Do mean edit the base acumatica file? I think that is a no-no.
@Joe Schmucker You can make the changes directly in the Customization Editor. If anything goes wrong, you can easily revert the changes by removing the customization package.
@Abhishek Niikam Thank you again for everything. I created a new project and put my DAC Ext, Graph Ext and the Code file using the code you so kindly wrote for me.
It is still not working. It is the only project published. The graph ext to bring the note text onto the grid works.
I have tried using Page_TS609090 (from your code) and Page_AP301110 as the class name. No luck.
I attached my project. If you publish it, I think you will see it is not working on AP301110.
If you are DONE with me here, no problem. You proved your project worked with your video, so I am going to mark your response as the best answer.