Acumatica:为EPApproval数据网格添加跨表虚拟字段报错
Hey there! Let's break down how to fix this issue you're having with adding the UsrSubID virtual field to the EPApproval data grid.
First, let's unpack the error
The message The type name 'usrSubID' does not exist in the type 'PX.Objects.RQ.RQRequest' points to two likely root causes:
- The custom
UsrSubIDfield hasn’t been properly published to theRQRequestData Access Class (DAC) - You’re using the wrong case or reference syntax for the field in your
PXDBScalarlogic
Step 1: Confirm the custom field exists and is published
- Open your Acumatica customization project
- Navigate to Customization > Dictionary > Tables > RQRequest
- Check if the
UsrSubIDfield is listed here. If not, add it (or verify it was added correctly in another project) - Make sure you’ve published the customization project—this generates the code needed to attach the field to the
RQRequestDAC
Step 2: Fix the PXDBScalar implementation
In Acumatica, custom fields use a specific BQL naming convention: the abstract field class is camelCase (matching the lowercase start of your custom field’s name). Here’s a corrected version of your extension class:
using PX.Data; using PX.Objects.EP; using PX.Objects.RQ; public class EPApprovalExtension : PXCacheExtension<EPApproval> { // Virtual field pulling UsrSubID from RQRequest [PXDBScalar(typeof(Search<RQRequest.usrSubID, Where<RQRequest.noteID, Equal<EPApproval.refNoteID>>>))] [PXUIField(DisplayName = "Sub ID")] // Add a user-friendly display name public virtual string UsrSubID { get; set; } // BQL field definition for the virtual field public abstract class usrSubID : PX.Data.BQL.BqlString.Field<usrSubID> { } }
Step 3: Add the field to the EPApproval grid
Once the extension is ready:
- Open the EPApproval screen in the customization editor
- Locate the data grid where you want the field to appear
- Add a new column, set its Data Field to
usrSubID(matching the abstract class name in your extension) - Republish the customization to apply all changes
Quick checks to avoid common pitfalls
- Double-verify the join condition:
RQRequest.noteID = EPApproval.refNoteIDonly works if every EPApproval record links to a RQRequest viarefNoteID. If some approvals aren’t tied to requests, consider handling null values. - Ensure you’re referencing the correct namespaces (
PX.Objects.RQfor RQRequest,PX.Objects.EPfor EPApproval). - If
UsrSubIDwas added to a DAC extension of RQRequest (not the base DAC), adjust your search to reference the extension:[PXDBScalar(typeof(Search<RQRequestExt.usrSubID, Where<RQRequest.noteID, Equal<EPApproval.refNoteID>>>))]
内容的提问来源于stack exchange,提问作者Fillip Kamati
相关产品推荐
相关产品推荐

