Good morning! I have a customer ID field included in the table DAC. I would like for this selector to operate identically to the customer ID field in the sales order form. I used all pertinent DAC code from the sales order to create the field in my custom screen; however, when I attempt to use all the same attributes for the restrictor, the following attribute cannot be accessed. I have all the appropriate references included in the project(PX.Objects.AR). Any assistance or work around for this issue would be greatly appreciated. Thank you!
#region CustomerID
public abstract class customerID : BqlInt.Field<customerID>
{
public class PreventEditBAccountCOrgBAccountID<TGraph> :
PreventEditBAccountRestrictToBase<BAccount.cOrgBAccountID, TGraph, NXBOL,
SelectFrom<NXBOL>
.Where<NXBOL.bolType.IsNotEqual<NXBOLType.nonProductMovement>.
And<NXBOL.customerID.IsEqual<BAccount.bAccountID.FromCurrent>>>>
where TGraph : PXGraph
{
protected override string GetErrorMessage(BAccount baccount, NXBOL document, string documentBaseCurrency)
{
return PXMessages.LocalizeFormatNoPrefix(Messages.CannotChangeRestricToIfShipmentExists,
documentBaseCurrency, baccount.AcctCD, document.BOLNbr);
}
}
public class PreventEditBAccountCOrgBAccountIDOnVendorMaint : PreventEditBAccountCOrgBAccountID<VendorMaint>
{
public static bool IsActive()
=> PXAccess.FeatureInstalled<FeaturesSet.multipleBaseCurrencies>();
}
public class PreventEditBAccountCOrgBAccountIDOnCustomerMaint : PreventEditBAccountCOrgBAccountID<CustomerMaint>
{
public static bool IsActive()
=> PXAccess.FeatureInstalled<FeaturesSet.multipleBaseCurrencies>();
}
}
protected Int32? _CustomerID;
[CustomerActive(
typeof(Search<BAccountR.bAccountID, Where<True, Equal<True>>>), // TODO: remove fake Where after AC-101187
Visibility = PXUIVisibility.SelectorVisible, Required = true)]
[CustomerOrOrganizationInNoUpdateDocRestrictor]
[PXForeignReference(typeof(Field<NXBOL.customerID>.IsRelatedTo<BAccount.bAccountID>))]
public virtual Int32? CustomerID
{
get
{
return this._CustomerID;
}
set
{
this._CustomerID = value;
}
}
#endregion
It appears that the [CustomerOrOrganizationInNoUpdateDocRestrictor] is not accessible. The project will not build and receive the following error:
Error CS0122 'CustomerOrOrganizationInNoUpdateDocRestrictor' is inaccessible due to its protection level
I have tried manipulating references, I would expect the attribute which is defined in PX.Objects.AR to work the same in my project as the PX.Objects.SO.
CustomerOrOrganizationInNoUpdateDocRestrictor is an internal class, so you can't access it.
You can use this restrictor instead:
[PXRestrictor(
typeof(Where<Customer.type, IsNotNull, Or<Current<PX.Objects.SO.SOOrder.aRDocType>,
Equal<ARDocType.noUpdate>, And<Current<PX.Objects.SO.SOOrder.behavior>, Equal<SOBehavior.tR>,
And<Where<BAccountR.type, In3<BAccountType.branchType, BAccountType.organizationType>,
Or<PX.Objects.CR.BAccount.isBranch, Equal<True>>>>>>>),
"Only a customer or company business account can be specified.")]