cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ct_klein
Helper I
Helper I

Filtering Leads to exclude certain Owners

Hi,

I have been stuck trying to solve an issue for a while now.  I have a canvas app where I am binding a listbox to D365 CDS for the Leads entity.  The 'Items' of the listbox is set to LeadListing.

I have setup this so far:

Collect(
LeadListing,
Sort(
Filter(
Leads,
Status = 'Status (Leads)'.Open &&
ct_leadtype = 'Prospect Type (Leads)'.Institutional
),
'Prospect Name',
Ascending
)
);
 
The problem is I need to add additional conditionals to the filter and I cannot figure out how.
I want to exclude certain Owners.  If the owner fullname is either 'Services, Alpha' or 'Services, Beta' I don't want it in the list.
I've looked for examples and found nothing that helped.
 
Any suggestions please.
 
thanks,
Chris
 
1 ACCEPTED SOLUTION

Accepted Solutions

OK, so I went with 'option B'

I created a view in the CRM which has all of the filtering requirements that I needed and I just set that as the Items source for the dropdown:

Filter(Leads, 'Leads (Views)'.'Pricing App Leads')
 
Way quicker/cleaner.
regards,
Chris
 

View solution in original post

6 REPLIES 6
KrishnaV
Community Champion
Community Champion

Hi @ct_klein ,

 

try this:

Collect(
LeadListing,
Sort(
Filter(
Leads,
Status = 'Status (Leads)'.Open &&
ct_leadtype = 'Prospect Type (Leads)'.Institutional &&
(ct_leadtype.DisplayName = "Services, Alpha" || ct_leadtype.DisplayName = "Services, Beta")
),
'Prospect Name',
Ascending
)
);


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

Hi @KrishnaV ,

 

It comes back with an error saying 'Name isn't valid, this identifier not recognized' for DisplayName.

 

thanks,

Chris

Hi @ct_klein,

 

Try this:

Collect(
LeadListing,
Sort(
Filter(
Leads,
Status = 'Status (Leads)'.Open &&
ct_leadtype = 'Prospect Type (Leads)'.Institutional &&
(LeadUserColumnName.DisplayName = "Services, Alpha" || LeadUserColumnName.DisplayName = "Services, Beta")
),
'Prospect Name',
Ascending
)
);


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

yeah, LeadUserColumnName comes up with the same identifier isn't recognized message.  I saw your other message and I am unable to initiate/receive video calls from my location due to internal security.

One of the things that always bugged me about Powerapps and Canvas, things that I think should be simple never are.  Practically every entity in D365 CRM has an owner field, I'd think it would be common enough occurrence that there would be more examples than I could possibly find.

If you have any other ideas I appreciate it, going to keep plugging at it.

 

 

Found another example that I thought should work but didn't @KrishnaV 

Collect(
LeadListing,
Sort(
Filter(
Leads,
Status = 'Status (Leads)'.Open && ct_leadtype = 'Prospect Type (Leads)'.Institutional
&& Not(AsType(Owner, [@Users] ).'Full Name' in ("Service, Alpha"))
&& Not(AsType(Owner, [@Users] ).'Full Name' in ("Service, Beta"))
),
'Prospect Name',
Ascending
)
);

OK, so I went with 'option B'

I created a view in the CRM which has all of the filtering requirements that I needed and I just set that as the Items source for the dropdown:

Filter(Leads, 'Leads (Views)'.'Pricing App Leads')
 
Way quicker/cleaner.
regards,
Chris
 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,918)