Hi @param2022 Â You can write a PXDefault<> for the Picker Name and fetch the AcctName, based on the current selected BAccountID in the Picker field.
Like belowÂ
Eg:Â
Add below PXDefault attribute to the PickerName field
  ÂPXDefault(typeof(Search<BAccount.acctname, Where<BAccount.baccountID, Equal<Current<YOURDACName .picker >>>>))]
[PXString()] [PXUIField(DisplayName = "Picker", Required = false, Enabled = true, Visibility = PXUIVisibility.SelectorVisible)] [PXDefault] [PXSelector(typeof(Search<EPEmployee.acctCD>), typeof(EPEmployee.bAccountID), typeof(EPEmployee.acctName))] public string Picker { get; set; } public abstract class picker : PX.Data.BQL.BqlString.Field<picker> { } [PXString()] [PXUIField(DisplayName = "Picker Name", Required = false, Enabled = false)] [PXDefault(typeof(Search<EPEmployee.acctName, Where<EPEmployee.acctCD, Equal<Current<HeaderExt.picker>>>>))] public string PickerName { get; set; } public abstract class pickerName : PX.Data.BQL.BqlString.Field<pickerName> { }
I did as you said @Naveen Boga  but it did not work. I also tried using PXFormula
@param2022 Â It seems there is a mistake in your code. Try like below.
Â
pPXDefault(typeof(Search<EPEmployee.acctName, Where<EPEmployee.baccountID , Equal<Current<HeaderExt.picker>>>>))]
@Naveen Boga  I changed the field in selector so I was using acctCD instead of bAccountID
@Naveen Boga  can you suggest anything else ??
Hi @param2022  Better you can take BAccountID instead of acctCD.
Searching should be with BAccountID and you can add the Substitute Key for AcctCD to display on the selector field.
You can modify the code like below and verify.
#region Picker PXString()] PXUIField(DisplayName = "Picker", Required = false, Enabled = true, Visibility = PXUIVisibility.SelectorVisible)] PXDefault()] PXSelector(typeof(Search<EPEmployee.bAccountID>), typeof(EPEmployee.bAccountID), typeof(EPEmployee.acctName), SubstituteKey = typeof(EPEmployee.acctCD))] public string Picker { get; set; } public abstract class picker : PX.Data.BQL.BqlString.Field<picker> { } #endregion #region PickerName PXString()] PXUIField(DisplayName = "Picker Name", Required = false, Enabled = false)] PXDefault(typeof(Search<EPEmployee.acctName, Where<EPEmployee.bAccountID, Equal<Current<HeaderExt.picker>>>>))] public string PickerName { get; set; } public abstract class pickerName : PX.Data.BQL.BqlString.Field<pickerName> { } #endregion
Â
@Naveen Boga  I have tried the exact code you provided and it is still not working. Can this be an issue related to Current<> we are using over here ?
Â
Hi, @param2022  I have added these fields in the Customers screen and verified with the below and it is working fine. Please find the code below for your reference.
Â
using PX.Data; using PX.Objects.AR; using PX.Objects.EP; using System; public class BAccountExt : PXCacheExtension<PX.Objects.CR.BAccount> { #region Picker PXInt()] PXUIField(DisplayName = "Picker", Required = false, Enabled = true, Visibility = PXUIVisibility.SelectorVisible)] PXDefault()] PXSelector(typeof(Search<EPEmployee.bAccountID>), typeof(EPEmployee.bAccountID), typeof(EPEmployee.acctName), SubstituteKey = typeof(EPEmployee.acctCD))] public int? Picker { get; set; } public abstract class picker : PX.Data.BQL.BqlInt.Field<picker> { } #endregion #region PickerName PXString()] PXUIField(DisplayName = "Picker Name", Required = false, Enabled = false)] PXDefault(typeof(Search<EPEmployee.acctName, Where<EPEmployee.bAccountID, Equal<Current<BAccountExt.picker>>>>))] public string PickerName { get; set; } public abstract class pickerName : PX.Data.BQL.BqlString.Field<pickerName> { } #endregion } public class CustomerMaintExt : PXGraphExtension<CustomerMaint> { protected virtual void Customer_Picker_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)// PXFieldDefaulting InvokeBaseHandler) { var row = (Customer)e.Row; if (row == null) return; BAccountExt ext = row.GetExtension<BAccountExt>(); EPEmployee obj = PXSelect<EPEmployee, Where<EPEmployee.bAccountID, Equal<Required<BAccountExt.picker>>>>.Select(Base, ext?.Picker); ext.PickerName = obj?.AcctName; } }
Â
Â
I an adding this in Pick Pack and Ship screen so i need scanheader extension class added my whole DAC extension here @Naveen Boga Â
public class HeaderExt : PXCacheExtension<ScanHeader> { PXString()] PXUIField(DisplayName = "Scanner", Required = false, Enabled = false)] PXEPEmployeeSelector] PXUnboundDefault(typeof(Search<EPEmployee.acctCD, Where<EPEmployee.userID, Equal<Current<AccessInfo.userID>>>>))] public string Scanner { get; set; } public abstract class scanner : PX.Data.BQL.BqlString.Field<scanner> { } PXString()] PXUIField(DisplayName = "Scanner Name", Required = false, Enabled = false)] PXEPEmployeeSelector] PXUnboundDefault(typeof(Search<EPEmployee.acctName, Where<EPEmployee.userID, Equal<Current<AccessInfo.userID>>>>))] public string ScannerName { get; set; } public abstract class scannerName : PX.Data.BQL.BqlString.Field<scannerName> { } #region Picker PXString()] PXUIField(DisplayName = "Picker", Required = false, Enabled = true, Visibility = PXUIVisibility.SelectorVisible)] PXDefault()] PXSelector(typeof(Search<EPEmployee.bAccountID>), typeof(EPEmployee.bAccountID), typeof(EPEmployee.acctName))] public string Picker { get; set; } public abstract class picker : PX.Data.BQL.BqlString.Field<picker> { } #endregion #region PickerName PXString()] PXUIField(DisplayName = "Picker Name", Required = false, Enabled = false)] ///PXDefault(typeof(Search<EPEmployee.acctName, Where<EPEmployee.bAccountID, Equal<Current<HeaderExt.picker>>>>))] PXFormula(typeof(Search<EPEmployee.acctName, Where<EPEmployee.bAccountID, Equal<Current<HeaderExt.picker>>>>))] public string PickerName { get; set; } public abstract class pickerName : PX.Data.BQL.BqlString.Field<pickerName> { } #endregion PXString()] PXUIField(DisplayName = "Scanning Status", Required = false, Enabled = false)] PXDefault(TypeCode.String, "Not Started")] public string ScanningStatus { get; set; } public abstract class scanningStatus : PX.Data.BQL.BqlString.Field<scanningStatus> { } }
Â
@Naveen Boga  do you this this issue is because I am accessing BAccount in ScanHeader DACExtension ?
Hi @param2022 Â - were you ever able to find a solution for this issue? Thank you!