Skip to main content
Answer

Trying to trigger field updated on a field in the Project screen

  • December 13, 2024
  • 4 replies
  • 124 views

Joe Schmucker
Captain II
Forum|alt.badge.img+3

On the Projects screen, I want to do some work when the Contract Total changes.

In the project editor, I generated the extension for the FieldUpdated event on this field.  This is the signature that was created.

   protected void PMProject_ProjectRevenueTotals.CuryAmount_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
 

I moved this code from the project editor to my VS project.  I got compiler errors.  I changed the signature to:

        protected void PMProject_ProjectRevenueTotals_CuryAmount_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
 

It compiles and I get no errors on the screen.

However, when click Include CO, the value in the field changes to 12,500.  I was hoping my extension would fire but it does not.

I set CommitChanges to true for the field but it still does not fire.

Any ideas on how I can trigger an event to fire when the value in the field changes?

 

Best answer by Django

It’s odd that it prefixed it with PMProject_

I would have expected the typical format:

DAC_Field_Event

Maybe try renaming the event to:

ProjectRevenueTotals_CuryAmount_FieldUpdated

4 replies

Forum|alt.badge.img+7
  • Captain II
  • Answer
  • December 13, 2024

It’s odd that it prefixed it with PMProject_

I would have expected the typical format:

DAC_Field_Event

Maybe try renaming the event to:

ProjectRevenueTotals_CuryAmount_FieldUpdated


Joe Schmucker
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • December 13, 2024

@Django Nope.  Caused the dreaded error:

I went with the nuclear option and did it in the rowselected of ProjectRevenueTotals

Edit: changed ProjectRevenueTotals to PMProjectRevenueTotal and it doesn’t throw an error.

Checking the CO box to change the value still doesn’t trigger the event.

Nuclear option it is.

 


darylbowman
Captain II
Forum|alt.badge.img+15
  • December 13, 2024

Did you try

protected virtual void _(Events.FieldUpdated<PMProjectRevenueTotal.curyAmount> e)

 


Joe Schmucker
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • December 14, 2024

I figured something out that wasn’t terribly obvious.  When you click Include CO checkbox, it doesn’t change values in any fields.  It simply hides CuryAmount and shows RevisedCuryAmount.  

I put code on fieldUpdated for the IncludeCO checkbox so that I could test changes to the field that is displayed on the screen.  

I will do some testing that will change the value in the curyamount field to change to see if it fires the field updated handler.

Here’s a first for me.  On this screen, RowSelected on the main DAC (PMProject) is completely done firing BEFORE anything is loaded on the PMProjectRevenueTotal DAC.  SO, if you want to look at something in the PMProjectRevenueTotal, you can’t do it from the PMProject DAC (for example, getting the current record in the PMProjectRevenueTotal cache from the PMProject event handler).  Because I am working on calculations that use Attribute fields, I do some checks in the RowSelected handler.  When I tried to get “current” on the revenue DAC, it was null.  Instead of doing it in the primary DAC, I have to do it in the revenue DAC.   I’ve never had that happen before.