I have a UDF UsrCustomerID.
I originally used this for my DAC
#region UsrCustomerID
[Customer]
[PXUIField(DisplayName = "Customer")]
[PXRestrictor(typeof(Where<BAccount.parentBAccountID, IsNotNull>), ICSMessages.ParentAccount)]
public virtual int? UsrCustomerID { get; set; }
public abstract class usrCustomerID : PX.Data.BQL.BqlInt.Field<usrCustomerID> { }
#endregion
I wanted to have access to the DescriptionField of the selector, so I tried this (which works)
#region UsrCustomerID
[PXDBInt]
[PXUIField(DisplayName = "Customer")]
[PXSelector(typeof(SearchFor<BAccount2.bAccountID>.
Where<BAccount2.type.IsEqual<GetICSCustomerType>.
And<BAccount2.parentBAccountID.IsNotNull>>),
typeof(BAccount2.acctCD),
typeof(BAccountCRM.acctName),
SubstituteKey = typeof(BAccount2.acctCD),
DescriptionField = typeof(BAccount2.acctName))]
[PXRestrictor(typeof(Where<BAccount2.parentBAccountID, IsNotNull>), ICSMessages.ParentAccount)]
public virtual int? UsrCustomerID { get; set; }
public abstract class usrCustomerID : PX.Data.BQL.BqlInt.Field<usrCustomerID> { }
#endregion
This is what is being displayed after selecting a customer. NOTE this is NOT a segmented field. My client is creating customers and manually putting a suffix in the account CD. It looks like it is segmented, but the AcctCD in the BAccount table is just a string “PT00019-PLN06969”.
I want to override the display on the screen to show a “substring” of the Customer number. I just want to show “PT00019” in that field.
I’m thinking there might be a way to use a SubString function on the DescriptionField like this:
DescriptionField = Substring(typeof(BAccount.description), 1, 7)) but that doesn’t compile.
Is this even possible? I don’t want to tell my client is cannot be done if it can.