Setting a field to null fires in the code but the date still gets filled in

  • 10 September 2021
  • 4 replies

Userlevel 4

I am working on the Task screen (CR306020).  I am able to set the Start Date to null so that the user must select a Start Date.  I want to also default the Due Date to null.

Here is my code:

    public class CRTaskMaint_Extension : PXGraphExtension<CRTaskMaint>
        #region Event Handlers

        protected void CRActivity_RowInserting(PXCache cache, PXRowInsertingEventArgs e)
            var row = (CRActivity)e.Row;
            //var dateAndTime = DateTime.Now;
            //var date = dateAndTime.Date.AddDays(1);
            row.StartDate = null;
            row.Priority = null;
            row.UIStatus = null;

        protected void _(Events.FieldUpdated<CRActivity, CRActivity.startDate> e)
            var row = (CRActivity)e.Row;
            row.EndDate = null;


The RowInserting works great.  The Start Date is empty after this code fires.

The FieldUpdated event fires.  I verified that the EndDate is being set to null.  But when the screen is updated, it shows the Start Date + 1 day.  This appears to be a default I cannot override.

I noted that the actual field name is EndDate_Date on the screen. In the editor, when you click on the Due Date field


You get this in the properties


I don’t know if what is going on behind the scenes to populate this field by Acumatica.

I looked in the CRTaskMaint.cs in the Acumatica repository and I don’t see any code there that sets any defaults for this field.  

This seems like it should be simple, but as usual, it is the simple changes that cause me so much grief.

Any help is greatly appreciated.

Joe Schmucker


Best answer by Naveen Boga 10 September 2021, 21:11

View original

4 replies

Userlevel 3
Badge +1

I believe you need to look at the EPStartDateAttribute and the associated FieldUpdating event to see the behavior.  You might need to update the DAC for the StartDate field if you want to change the default behavior.

Userlevel 7
Badge +12

Hi Joe,

Just to inform you that there is no code in CRTaskMaint related to “EndDate” field.

This value is updating in RowUpdated Event, this code is available inside the EPEndDateAttribute. Please find the screenshot for reference. As soon as Start Date is updated then EndDate will updated using RowUpdated event code.

Userlevel 4

When I go to customize the Task screen, I inspect the element and it shows it is part of CRTaksMaint, not anything to do with EPTaskEnq.  I don’t know how to create the Visual Studio code to add a customized row updated handler for this.  I am not too good at this and I don’t know how to setup the Class signature for the EPTaskEnq graph.  I normally use Acumatica to create the code in the project editor and then send it over to Visual Studio. 


I found another piece of code from another developer

I tried putting this code in this class.  The event doesn’t fire in Debug mode. 

I would like to know how I would have generated this from Acumatica.  By using the inspector on the Acumatica site, I don’t see anything to reference EPTaskEnq?


In the Acumatica project editor, I tried to override the Attribute on EndDate (shows as Due Date in the editor, but the Field Name is EndDate


I get this error.

This “tiny” edit has turned out to be a lot harder than I thought it would.



Userlevel 4

Thanks all for your inputs.  This is working now.  If the StartDate is updated, it sets the EndDate to null.  Seems to be doing the trick.

        protected void _(Events.RowUpdated<CRActivity> e)
            if (!e.Cache.ObjectsEqual<CRActivity.startDate>(e.Row, e.OldRow))
                e.Row.EndDate = null;

I found the Cache.ObjectsEqual in the Acumatica training.  Thank God for the Acumatica training code.  


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2022  Acumatica, Inc. All rights reserved