I have this customized selector attribute to filter Projects to the current customer on CRActivityMaint:
public class DSRestrictActivityProjects_CRActivityMaint_Ext : PXGraphExtension<CRActivityMaint>
{
[PXRemoveBaseAttribute(typeof(EPProjectAttribute))]
[CustomerProjects]
protected virtual void _(Events.CacheAttached<PMTimeActivity.projectID> e)
{ }
public class CustomerProjects : PXCustomSelectorAttribute
{
public CustomerProjects()
: base(typeof(PMProject.contractID),
typeof(PMProject.contractCD),
typeof(PMProject.description),
typeof(PMProject.status))
{
SubstituteKey = typeof(PMProject.contractCD);
DescriptionField = typeof(PMProject.description);
}
public virtual IEnumerable GetRecords()
{
CRActivity activity = (CRActivity)_Graph.Views["CurrentActivity"].Cache.Current;
if (activity is null || activity?.RefNoteID is null)
return null;
return SelectFrom<PMProject>.
LeftJoin<CRCase>.
On<CRCase.customerID.IsEqual<PMProject.customerID>>.
Where<PMProject.baseType.IsEqual<CTPRType.project>.
And<CRCase.noteID.IsEqual<@P.AsGuid>>>.
View.Select(_Graph, activity.RefNoteID).FirstTableItems;
}
}
}
It works fantastically, except that I can’t actually select a record.
What did I do wrong?