I have created one selector custom field in Customers screen and managed to grab Reason Code information using the code below:
public class BAccountExt : PXCacheExtension<PX.Objects.CR.BAccount>
{
#region UsrReasonCode
[PXDBString(CS.ReasonCode.reasonCodeID.Length, IsUnicode = true)]
[PXUIField(DisplayName="Reason Code")]
[PXSelector(typeof(Search<CS.ReasonCode.reasonCodeID,
Where<CS.ReasonCode.usage, Equal<ReasonCodeUsages.sales>,
Or<ReasonCode.usage, Equal<ReasonCodeUsages.issue>>>>),
DescriptionField = typeof(ReasonCode.descr), CacheGlobal = true)]
[PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
public virtual string UsrReasonCode { get; set; }
public abstract class usrReasonCode : PX.Data.BQL.BqlString.Field<usrReasonCode> { }
#endregion
}
}
How can I grab the value set in the Customers screen and make it a default value in Sales Order screen. I have tried replacing the Reason Code field with the code below but failed to get the desired result:
[PXDBString(CS.ReasonCode.reasonCodeID.Length, IsUnicode = true)]
[PXSelector(typeof(Search<ReasonCode.reasonCodeID,
Where<Current<SOLine.tranType>, Equal<INTranType.transfer>, And<ReasonCode.usage,
Equal<ReasonCodeUsages.transfer>,
Or<Current<SOLine.tranType>, NotEqual<INTranType.transfer>, And<ReasonCode.usage,
In3<ReasonCodeUsages.sales, ReasonCodeUsages.issue>>>>>>), DescriptionField = typeof(ReasonCode.descr))]
[PXDefault(typeof(BAccountExt.usrReasonCode), PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Reason Code")]