[SOLVED] Acumatica How to customize Time Entries and Activities with Custom Selector Field


We want to customize the time entries and activities logic to have a custom selector field that pulls information from an attribute that is setup in the system. It has to be a required field if the TimeSpent and BilledTime does not match, the entry is marked as billable, and the project has a customer loaded against it. I have successfully managed to get it working on the Employee Time Activities screen, but I am trying to use that same custom field on the Activities popup dialog. I also get an error when adding an Activity directly to project, which states that the Time Entry requires a Reason Code but I don’t have access to add it to the list to display on the Activities Panel/Dialog.
See screenshots below:

Employee Time Activities

List of Attributes

Ignore the Activity Reason Code, this is an additional custom field I added to test the customization.
Add Activity to Project

I want to add my custom field in here:
Customize Activities Dialog

Below is the extention class DAC.

using PX.Data;
using PX.Objects.CS;
using PX.Objects.PM;
using iPlanReasonCode.Helpers;

namespace PX.Objects.CR
    public class PMTimeActivityExt : PXCacheExtension<PX.Objects.CR.PMTimeActivity>
        #region UsrReasonCode
        [PXUIField(DisplayName = "Reason Code")]
        [PXSelector(typeof(Search<CSAttributeDetail.valueID, Where<CSAttributeDetail.attributeID.IsEqual<ReasonCodeAttributeID>>>),
            typeof(CSAttributeDetail.valueID), typeof(CSAttributeDetail.description), SubstituteKey = typeof(CSAttributeDetail.valueID), DescriptionField = typeof(CSAttributeDetail.description))]
        [PXUIRequired(typeof(Where<PMTimeActivity.isBillable.IsEqual<True>.And<PMTimeActivity.timeSpent.IsNotEqual<PMTimeActivity.timeBillable>>.And<Where<Selector<PMTimeActivity.projectID, PMProject.customerID>, IsNotNull>>>))]
        public virtual string UsrReasonCode { get; set; }
        public abstract class usrReasonCode : PX.Data.BQL.BqlString.Field<usrReasonCode> { }

Below is the helper constant class to point it to the correct attribute code.

using PX.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace iPlanReasonCode.Helpers
    public class ReasonCodeAttributeID  : PX.Data.BQL.BqlString.Constant<ReasonCodeAttributeID>   
        public ReasonCodeAttributeID()
                : base("CUSTREASON")
        { }


So this one is a bit tricky, for some reason Acumatica’s "Add data fields" on the customization project browser does not recognize the "TimeActivity" view, which is the view in which your field is added to (on PMTimeActivity).

What you should do if you want to keep the field on this record is manually edit the ASPX, find the area of the page where you see fields referencing Datafield="TimeActivity.***" and manually add an XML Tag and reference the timeactivity data view the same way e.g. DataField="TimeActivity.UsrYourCustomField"


   <px:PXTextEdit ID="chkYourField" runat="server" DataField="TimeActivity.UsrYourCustomField" />


   <px:PXCheckBox ID="chkYourField" runat="server" DataField="TimeActivity.UsrYourCustomField" />

After you manually add the tag, then you will be able to move it around using the UI

If you want to skip over all of this and just make it easy, move your custom field to the CRActivity DAC

Answered By – Kyle Vanderstoep

Answer Checked By – David Goodson (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *