protected IEnumerable items()
        {
            string actionName = CRMassProcessingAttribute.GetSelectedAction(Items.View);

            if (CRMergeAttribute.IsMergeAction(actionName))
            {
                return(new PXSelectJoin <CRContactBatch,
                                         LeftJoin <CRLeadBatch, On <CRLeadBatch.contactID, Equal <CRContactBatch.contactID> >,
                                                   LeftJoin <BAccount, On <CRContactBatch.bAccountID, Equal <BAccount.bAccountID> >,
                                                             LeftJoin <Address, On <Address.addressID, Equal <CRContactBatch.defAddressID> > > > >,
                                         Where <CRContactBatch.contactType, Equal <ContactTypes.person>,
                                                And <Where <CRContactBatch.bAccountID, NotEqual <Current <Company.bAccountID> >,
                                                            Or <CRContactBatch.bAccountID, IsNull> > > > >(this).Select());
            }
            if (CRUpdateAttribute.IsUpdateAction(actionName))
            {
                return(new PXSelectJoin <CRContactBatch,
                                         InnerJoin <CRLeadBatch, On <CRLeadBatch.contactID, Equal <CRContactBatch.contactID> >,
                                                    LeftJoin <Address, On <Address.addressID, Equal <CRLeadBatch.defAddressID> > > >,
                                         Where <CRLeadBatch.bAccountID, IsNull> >(this).Select());
            }
            if (actionName == ASSIGNLEADS_ACTIONNAME)
            {
                return(new PXSelectJoin <CRContactBatch,
                                         InnerJoin <CRLeadBatch, On <CRLeadBatch.contactID, Equal <CRContactBatch.contactID> >,
                                                    LeftJoin <Address, On <Address.addressID, Equal <CRLeadBatch.defAddressID> > > >,
                                         Where <CRLeadBatch.workgroupID, IsNull> >(this).Select());
            }
            return(new PXResultset <CRContactBatch, CRLeadBatch, BAccount, Address>());
        }
        protected IEnumerable leadItems()
        {
            string actionName = CRMassProcessingAttribute.GetSelectedAction(Items.View);

            if (CRMergeAttribute.IsMergeAction(actionName) || CRUpdateAttribute.IsUpdateAction(actionName))
            {
                return(new PXSelect <CRLeadBatch, Where <CRLeadBatch.bAccountID, IsNull> >(this).Select());
            }
            if (actionName == ASSIGNLEADS_ACTIONNAME)
            {
                return(new PXSelect <CRLeadBatch, Where <CRLeadBatch.workgroupID, IsNull> >(this).Select());
            }
            return(new PXResultset <CRLeadBatch>());
        }