Acumatica扩展中无法通过翻译字典修改DAC缓存名称的解决方法问询
Great question—this is a super common pain point when customizing Acumatica, especially for nested or related DAC views that don’t show up in the standard translation dictionary. Let’s walk through the practical, supported methods you can use to fix this:
Method 1: Extend the DAC Field to Override Display Name
For related objects like Lead/Contact on APInvoice or Vendor, these are often linked via fields with PXSelector or PXParent attributes. You can extend the target DAC to redefine these fields with a custom display name, which will update both the UI label and the associated cache/view name.
Here’s an example for overriding the Contact field on APInvoice:
public class APInvoiceExt : PXCacheExtension<APInvoice> { [PXDBInt] [PXUIField(DisplayName = "Primary Contact")] // Your custom name here [PXSelector( typeof(Search<Contact.contactID>), typeof(Contact.displayName), DescriptionField = typeof(Contact.displayName) )] [PXParent(typeof(SelectFrom<Contact>.Where<Contact.contactID.IsEqual<APInvoice.contactID.FromCurrent>>))] public virtual int? ContactID { get; set; } public abstract class contactID : PX.Data.BQL.BqlInt.Field<contactID> { } }
By redefining the field with your desired DisplayName while preserving the original business logic, you’ll see the custom name reflected in the UI and any related cache references.
Method 2: Modify the View’s Cache Name in a Graph Extension
If the Lead/Contact view exists directly on the Vendor screen (like in the VendorMaint graph), you can extend the graph and update the cache name during initialization. This works well for existing views that aren’t exposed in the translation dictionary.
Example for VendorMaint:
public class VendorMaintExt : PXGraphExtension<VendorMaint> { public override void Initialize() { base.Initialize(); // Update Contact view name var contactCache = Base.Caches[typeof(Contact)]; if (contactCache?.View != null) { contactCache.View.CacheName = "Vendor Contact Details"; } // Update Lead view name (if applicable) var leadCache = Base.Caches[typeof(Lead)]; if (leadCache?.View != null) { leadCache.View.CacheName = "Associated Lead"; } } }
This directly targets the cache’s view property to set a custom name, which will show up in places like the screen’s header or any cache-related UI elements.
Method 3: Use Custom Localization for Multi-Language Support
If you need to support multiple languages, skip hardcoding names and use a custom resource file with PXLocalizeAttribute.
- Create a new resource file (e.g.,
CustomAcumaticaResources.resx) and add your key-value pairs (e.g.,VendorContactLabel= "Primary Vendor Contact"). - Reference the resource in your DAC extension:
public class APInvoiceExt : PXCacheExtension<APInvoice> { [PXDBInt] [PXLocalize(typeof(CustomAcumaticaResources), "VendorContactLabel")] [PXUIField(DisplayName = "")] // Leave empty to let localization take over [PXSelector( typeof(Search<Contact.contactID>), typeof(Contact.displayName) )] public virtual int? ContactID { get; set; } public abstract class contactID : PX.Data.BQL.BqlInt.Field<contactID> { } }
This keeps your customization flexible and aligned with Acumatica’s localization framework.
Key Notes to Remember
- Always use extensions (DAC/Graph) instead of modifying native Acumatica code—this ensures your changes survive upgrades.
- After making changes, clear Acumatica’s cache via System > Management > Cache Management to see updates immediately.
- For nested views, double-check if the view is defined in the base graph or a nested container—you may need to target the correct cache instance.
内容的提问来源于stack exchange,提问作者Shalaal

