Skip to main content
Answer

Modification of a standard field changes it to a virtual field

  • February 25, 2024
  • 1 reply
  • 54 views

Good day everyone, 

We have a changed the description field of the OwnerID (standard field) and changed the description field to use our usrCustomName field like this:
 

[PXNonInstantiatedExtension]
public class CR_CROpportunity_ExistingColumn : PXCacheExtension<PX.Objects.CR.CROpportunity>
{
#region OwnerID
[PXDBInt]
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXCustomizeBaseAttribute(typeof(OwnerAttribute), "DescriptionField",
typeof(MAKLBAccountExt.usrCustomName))]
[PXSelector(typeof(Search<EPEmployee.defContactID>),
typeof(EPEmployee.acctCD),
typeof(EPEmployee.acctName),
typeof(BAccountExt.usrCustomName))]
public int? OwnerID { get; set; }
#endregion
}

The changes we made is on the CROpportunityExt DAC.

The problem we face now however is that we get an error on the Generic Inquiries

and the DAC Schema also displays this:

 

 

If I unpublish this, it works. 

Has any one ever experienced this and if so, how did you get around this? Is there something I did wrong in the code? 

 

Thanks in advance. 

Best answer by darylbowman

There are a couple things I would try:

  1. You have the merge method specified as MergeMethod.Append, but you are redefining the selector, which I believe you’d want to replace. I would try MergeMethod.Merge
  2. You’re redefining [PXDBInt], which may be required, since it’s originally rolled into the [Owner] attribute, but you are going to need to define the BQL field that this field is attached to, because CROpportunity is a projection

I would try something like this:

#region OwnerID  
[PXMergeAttributes(Method = MergeMethod.Merge)]
[PXCustomizeBaseAttribute(typeof(OwnerAttribute), "DescriptionField",
typeof(MAKLBAccountExt.usrCustomName))]
[PXDBInt(BqlField = typeof(Standalone.CROpportunityRevision.ownerID))]
[PXSelector(typeof(Search<EPEmployee.defContactID>),
typeof(EPEmployee.acctCD),
typeof(EPEmployee.acctName),
typeof(BAccountExt.usrCustomName))]
public int? OwnerID { get; set; }
#endregion

 

1 reply

darylbowman
Captain II
Forum|alt.badge.img+15
  • Answer
  • February 26, 2024

There are a couple things I would try:

  1. You have the merge method specified as MergeMethod.Append, but you are redefining the selector, which I believe you’d want to replace. I would try MergeMethod.Merge
  2. You’re redefining [PXDBInt], which may be required, since it’s originally rolled into the [Owner] attribute, but you are going to need to define the BQL field that this field is attached to, because CROpportunity is a projection

I would try something like this:

#region OwnerID  
[PXMergeAttributes(Method = MergeMethod.Merge)]
[PXCustomizeBaseAttribute(typeof(OwnerAttribute), "DescriptionField",
typeof(MAKLBAccountExt.usrCustomName))]
[PXDBInt(BqlField = typeof(Standalone.CROpportunityRevision.ownerID))]
[PXSelector(typeof(Search<EPEmployee.defContactID>),
typeof(EPEmployee.acctCD),
typeof(EPEmployee.acctName),
typeof(BAccountExt.usrCustomName))]
public int? OwnerID { get; set; }
#endregion