cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

How to Map contact record of contact Entities with different Entities which have relationship established

Hi Experts,

I am new to the power portal.

I have one requirement where in my CDS there is an existing Entities present called "Employee_Detail", which have NameID, Name, Emp_ID, Email_ID, DOB, Department, City etc. here NameID is a Primary Key ( i.e Concat(Emp_ID, Name) ).

But currently there are no records of contact created/present in Contact Entities.

We will be asking the client to create the contacts of every person (which are present in "Employee_Detail" Entities) by going to the registration page or manually. (Please suggest any other automatic way)

My first requirement is, how to map the Contact Entities to Employee_Detail Entities records. As I mentioned there are no contacts created/present now.

I have created a lookup field for Contact Entities in "Employee_Detail" Entities and also created a relationship by going to the relationship tab in "Employee_Detail" Entities.

How to map the "Employee_Detail" records to Contact Entities automatically? Any option by which when creating Contact manually or automatically to map it to "Employee_Detail" records?

 

Please suggest any solution to this.

 

Thanks,

Amit

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: How to Map contact record of contact Entities in a different Entities which have relationship established

Hi @AmitSah ,

Yes, you can. I think the "Edit data in Excel" functionality could achieve your needs.

 

You could go to the Contacts Entity and Employee Details Entity in your CDS, then click "Edit data in Excel" button, then it would export your CDS Entity into a Excel table.

8.JPG

 

Opening the exported Excel file, then you could use the "Microsoft PowerApps Office Add-In" plugin to publish the data (including adding, removing, modifying, ....) from Excel file to your CDS Entity.

Please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/common-data-service/data-platform-excel-addin

 

But if you want to bind the contact in your exported Employee Details Excel table, you still need to manually add the contact record in your exported Contact Excel table firstly, then publish the new contact record back to your CDS Entity. After that, you could click "Refresh" button though the "Microsoft PowerApps Office Add-In" plugin in your Employee Details Excel file, and select the LookUp field, then you could see these contact record you could reference there.

 

If above solution is helpful in your scenario, please go ahead to click "Accept as Solution" to identify my reply as helpful.

 

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

10 REPLIES 10
Highlighted
Solution Sage
Solution Sage

Re: How to Map contact record of contact Entities in a different Entities which have relationship established

I am a bit confused

 

when you say link them automatically.. what do you mean?

 

do you mean once creating the "employee" you automatically create a contact? if that's your requirement a real-time workflow in your model-driven app should sort the problem:

https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/workflow-proce...


------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

Highlighted
Helper II
Helper II

Re: How to Map contact record of contact Entities in a different Entities which have relationship established

Hi @OliverRodrigues 

 

Apology for not being clear.

Basically Contact Entities is not having any records now. and we are using local authentication.

The client has already few entities available in the CDS. So, for example "Employee_Detail" is one of those entities. which have records present for all employees.

Now, as in Contact Entities, there are no records present.. Now, the client asked us, how we can link/map/related Contact records (when they create all the contacts of the employee) to "Employee_Detail" entities. because they want to see the records specific to the logged-in users.

Please let me know if it's clear your doubt.

@OOlashyn  If you have any solution please let me know.

Thanks,

Highlighted
Community Support
Community Support

Re: How to Map contact record of contact Entities in a different Entities which have relationship established

Hi @AmitSah ,

Could you please share a bit more about "map the "Employee_Detail" records to Contact Entities automatically"? What do you mean?

Do you want to create corresponding Contact record for each record in your "Employee_Detail" Entity?

 

If you want to create corresponding Contact record for each record in your "Employee_Detail" Entity, I think PowerApps canvas app could achieve your needs. You could consider create a Blank app, then add your "Employee_Detail" Entity and Contacts Entity as data source in this app. Within this app screen, add a Button called "Sync", set the OnSelect property to following:

ForAll(
       Employee_Detail,
       Patch(
             Contacts,
             Defaults(Contacts),
             {
               'First Name': First(Split(Name, ' ')).Result, 
               'Last Name': Last(Split(Name, ' ')).Result,
               Email: Email_ID
             }
       )
)

Note: The Name and Email_ID columns are both from your "Employee_Detail" Entity. And within the Name column, it store the name like "Priya Santra", "Smith Liu", ..... Within the Email_ID, it store the email address of the employee.

When you press above "Sync" button, the ForAll formula would be executed, and create one contact for each employee in your Contacts Entity (sync all ).

ForAll function, Patch function

If you want to bind the Contact record with the "Employee_Detail" record through the One-to-Many relationship, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-relate-unrelate

 

In addition, if you want to create a corresponding Contact in your Contacts Entity when a new employee is added in your "Employee_Detail", I think Power Automate flow could achieve your needs. Please consider configure your flow as below:

6.JPG

 

Please consider take a try with above solution, 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.
Highlighted
Helper II
Helper II

Re: How to Map contact record of contact Entities in a different Entities which have relationship established

Hi @v-xida-msft 

Thank you for your response.

With "map the "Employee_Detail" records to Contact Entities automatically", I mean that in "Employee_Detail" entities I have one lookup field (also created a relationship 1:N with Contacts entities) which needs to relate/link/map with contacts in Contact Entities when we populate/create contacts( currently there is no contacts available in Contact Entities).

Example:

Contact:

Name                   Email                         Address   First Name          Last Name

David Herrary      david.h@xyz.com      XYVA       David                   Herrary

 

The above record is not present in Contact Entities but when we create it manually or automatically then how to link/relate/map it with Employee_Detail Entities.

 

Employee_Detail:

Name      Email                         Department     Emp_Code      Contact_Lookup         Employee_Detail

David      david.h@xyz.com      IT                      1133               David Herrary             dfdgfsfhfbdfs (this is an auto-generated value by Entities)

 

So, the bold one is a contact value that needs to present/relate/link/map in "Employee_detail" which will establish a relationship with Contact entities.

Please let me know if that clears the point. and also please suggest if there is any best way to do that.

 

Thanks,

Amit

 

Highlighted
Community Support
Community Support

Re: How to Map contact record of contact Entities in a different Entities which have relationship established

Hi @AmitSah ,

Based on the needs that you mentioned, I think the Relate function could achieve your needs. The Relate function links two records through a one-to-many or many-to-many relationship in Common Data Service.

 

Please check the following article for more details:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-relate-unrelate

 

You need to create a canvas app, then within this canvas app, you could use the Relate function to link the record from the Contact Record to the Employee Details Record.

 

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.
Highlighted
Helper II
Helper II

Re: How to Map contact record of contact Entities in a different Entities which have relationship established

Hi @v-xida-msft 

 

By going through the article it seems that Relate function will work but that is also a manual effort to relate the entities.

Please let me know if I am wrong with understanding? If I understood correctly then is there any automatic way to Relate the entities.

 

Thanks,

Amit

Highlighted
Community Support
Community Support

Re: How to Map contact record of contact Entities in a different Entities which have relationship established

Hi @AmitSah ,

Do you want to relate the Entities in your CDS automatically?

 

Based what I have known, if you want to relate the Entities in your CDS automatically in canvas app or Power Automate flow, I afraid that there is no way to achieve your needs automatically.

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/Power-Apps-Ideas/idb-p/PowerAppsIdeas

 

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.
Highlighted
Helper II
Helper II

Re: How to Map contact record of contact Entities in a different Entities which have relationship established

Hi @v-xida-msft 

Thanks for your response. It help's a lot to understand the things and it will help to give a proper explanation to the client about the behavior.

But Could you please help me in understanding that via Excel (vLookup or something else) we can achieve that. i.e by exporting both the entities data and making changes in excel and then upload the data to the Entities. In that way will it work?

 

Hoping to get some help with this.

 

Thanks,

Amit

Highlighted
Solution Sage
Solution Sage

Re: How to Map contact record of contact Entities in a different Entities which have relationship established

Hi @AmitSah ,

 

As @OliverRodrigues pointed out the easiest way to achieve automatic creation of Contacts from your Employees and relate them will be through CDS Workflows if you want to have it as a real time process or you can do it through Power Automate as well. On creation of the Employee you would need to trigger workflow/flow that will create a contact based on the values in Employee and then update lookup on the Employee with newly created contact.

----------------------------------------------------
If you find this post helpful consider marking it as a solution to help others find it.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Users online (9,944)