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;
}
#endregion
}
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