cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SteveCampbell
Level: Powered On

Filter contacts from Dynamics 365

Hi all,

 

New to dynamics. 

Requirements:

  • User selects an account
  • Contact are disaplyed for this account, and all linked accounts

I only need to go 1 level deep, i.e. accounts linked directly to the selected account

 

I have this code that lists all accountid that I'm interested in

ClearCollect(
ListConnections,
{_record1id_value: GUID(SelectedID)}
);
Collect(
ListConnections,
Filter(
Connections_1,
_record2id_value = GUID(SelectedID)
)._record1id_value
)

that returns a collection of all accounts and immediate related accounts.

I'm trying to return contacts.

 

 

Filter( Contacts_1,  GUID(_parentcustomerid_value)
 in ListConnections._record1id_value )

Somthing like this, but it never returns anything. I can see the _parentcustomerid_value and _record1id_value match, but it will not join correctly.

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Filter contacts from Dynamics 365

Hi @SteveCampbell ,

Could you please share a bit more about your ListConnections collection? Is it populated with available Account Id (GUID value, e.g. 'dc11fa81-0aa9-e911-a9c6-000d3a828574') values?

Do you want to filter your Contacts Entity records based on the available Account Id values in your ListConnections collection?

 

Based on the formula you provided, I think there is something wrong with it. Actually, the 'Company Name' (parentcustomerid) column is a Polymorphic lookup field in CDS Entity, which could references records from Accounts Entity or Contacts Entity, please check the following article for more details:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-references#show-the-fields...

 

I have made a test on my side, please take a try with the following workaround:6.JPG

Set the Items property of the Gallery to following formula:

 

Filter(
Contacts,
AsType('Company Name', [@Accounts]).Account in ListConnection.Value
)

 

 

On your side, you need to add Accounts Entity as data source in your app firstly, then set the Items property of the Gallery to following:

 

Filter(
Contacts_1,
AsType('Company Name', [@Accounts]).Account in ListConnections._record1id_value
)

Note: I assume that your ListConnections collection is populated with all available account id value (GUID value).

 

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: Filter contacts from Dynamics 365

Hi @SteveCampbell ,

Could you please share a bit more about your ListConnections collection? Is it populated with available Account Id (GUID value, e.g. 'dc11fa81-0aa9-e911-a9c6-000d3a828574') values?

Do you want to filter your Contacts Entity records based on the available Account Id values in your ListConnections collection?

 

Based on the formula you provided, I think there is something wrong with it. Actually, the 'Company Name' (parentcustomerid) column is a Polymorphic lookup field in CDS Entity, which could references records from Accounts Entity or Contacts Entity, please check the following article for more details:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-references#show-the-fields...

 

I have made a test on my side, please take a try with the following workaround:6.JPG

Set the Items property of the Gallery to following formula:

 

Filter(
Contacts,
AsType('Company Name', [@Accounts]).Account in ListConnection.Value
)

 

 

On your side, you need to add Accounts Entity as data source in your app firstly, then set the Items property of the Gallery to following:

 

Filter(
Contacts_1,
AsType('Company Name', [@Accounts]).Account in ListConnections._record1id_value
)

Note: I assume that your ListConnections collection is populated with all available account id value (GUID value).

 

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,530)