I have 2 custom fields, Customer and Project, that are required. The second field is a selector that is dependent on the value that is in the first field.
Customer Field:
[PXDBInt]
[PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Customer", Required = true)]
[PXSelector(typeof(SearchFor<Customer.bAccountID>
.In<SelectFrom<Customer>
.InnerJoin<BAccount2>
.On<Customer.bAccountID.IsEqual<BAccount2.bAccountID>>>),
new Type[] {
typeof(Customer.bAccountID),
typeof(BAccount2.acctName)
},
DescriptionField = typeof(BAccount2.acctName))]
public int? UsrMOSCustomerID { get; set; }
public abstract class usrMOSCustomerID : BqlInt.Field<usrMOSCustomerID> { }
Project Field:
[PXDBString]
[PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Project", Required = true)]
[PXSelector(typeof(SearchFor<MOSCustomerProject.mosprojectid>
.In<SelectFrom<MOSCustomerProject>
.Where<MOSCustomerProject.customerID.IsEqual<usrMOSCustomerID.FromCurrent>>>),
new Type[] {
typeof(MOSCustomerProject.mosprojectid),
typeof(MOSCustomerProject.descr)
})]
public string UsrMOSProjectID { get; set; }
public abstract class usrMOSProjectID : BqlString.Field<usrMOSProjectID> { }
The thing that I can’t figure out is how to clear the second field when the first field changes. The specific use case is I have two Customers. Customer #1 has projects TEST1 and TEST2, customer #2 has projects TEST3 and TEST4. First, I select Customer #1 and TEST2. Then I change the customer to Customer #2. At this point, Project still shows TEST2. I think it should show nothing.
Can I have it do what I want and if so, how?