I'm trying to auto-populate a field based on another field. I have a selector field for Contracts and I created a Manager 1 field for the primary manager which is captured in the Contracts screen.
I am able to get the correct results when opening the selector field for Manager 1. It populates the contract code and the manager associated with it; however, I want it to fill in the field automatically once I select a contract. I've tried using PXDefault, but didn't have any luck. The code below is what I have working so far:
[PXInt]
[PXUIField(DisplayName="Manager 1")]
[PXSelector(typeof(Search2<PX.Objects.CR.BAccount.bAccountID,
InnerJoin<JPMContract,
On<JPMContract.contractMgrBAccountID,
Equal<PX.Objects.CR.BAccount.bAccountID>>>>),
typeof(JPMContract.contractCode),
typeof(PX.Objects.CR.BAccount.acctCD),
typeof(PX.Objects.CR.BAccount.acctName),
SubstituteKey = typeof(PX.Objects.CR.BAccount.acctCD),
DescriptionField = typeof(PX.Objects.CR.BAccount.acctName))]
Again, when I open the selector field and select the corresponding result, I get the results I want, but I want it to do this for me once a contract is selected. Any advice?
UPDATE: I got it to only return the one result I need in the selector but it still doesn't populate with that one result in the field.
[PXInt]
[PXSelector(typeof(Search2<PX.Objects.CR.BAccount.bAccountID,
InnerJoin<JPMContract,
On<JPMContract.contractMgrBAccountID,
Equal<PX.Objects.CR.BAccount.bAccountID>>>,
Where<JPMContract.jPMContractID, Equal<Current<JPMSubContract.jPMContractID>>>>),
typeof(JPMContract.contractCode),
typeof(PX.Objects.CR.BAccount.acctCD),
typeof(PX.Objects.CR.BAccount.acctName),
SubstituteKey = typeof(PX.Objects.CR.BAccount.acctCD),
DescriptionField = typeof(PX.Objects.CR.BAccount.acctName))]
[PXDefault(typeof(Search2<PX.Objects.CR.BAccount.bAccountID,
InnerJoin<JPMContract,
On<JPMContract.contractMgrBAccountID,
Equal<PX.Objects.CR.BAccount.bAccountID>>>,
Where<JPMContract.jPMContractID, Equal<Current<JPMSubContract.jPMContractID>>>>))]
[PXUIField(DisplayName="Manager 1")]