Part 1 of series explains how to create entity, field, relationships and import data. In this blog we will see how CDS for Apps automatically creates entity for you while importing data. We will make use of below excel data to add Products for Companies. Same is uploaded to one-drive.
Product Name | Company | Expired | Expiration Date |
HCL_P1 | HCL | No | |
HCL_P2 | HCL | No | |
Microsoft_P1 | Microsoft | Yes | 1-Jan-18 |
Microsoft_P2 | Microsoft | No | |
Microsoft_P3 | Microsoft | No | |
Microsoft_P4 | Microsoft | No | |
Power_P1 | Power Objects | Yes | 1-Mar-18 |
Power_P2 | Power Objects | Yes | 1-Jun-18 |
Power_P3 | Power Objects | No |
Steps:
- Login to PowerApp web portal. Navigate to Data -> Entities and Click on Get Data
- Select Excel from list of data source, enter Product excel file url. Refer Part 1 to know how to get excel file URL and use it. Click on Next
- Select Table1 and Click Next
- Product data will be displayed. Power Query allows us to modify column names, types, add or remove columns or any other transformations. We will change data type for column “Expiration Date” to Date/Time/Zone
Note – Currently CDS for Apps does not accept Date or Date/Time, so you need to convert your date type columns to Date/Time/Zone type.
- Click on image button ABC/123 left next to Expiration Date and select Date/Time/Zone
- Expiration Date column data will be transformed to have time and time zone part. Also you will see one transformation step added on right side under Applied Steps. Which means for each transformation Power Query will add step under Applied Steps and you can always go back to previous state by selecting previous step. Click Next
- Select “Load to new entity” option. Provide entity name, entity display name and select Primary Name field in drop down. Click Next
- Entity will be created and data will be imported, Click Done. Select Entities on left navigation and change default view to custom on top to display only custom entities. You will see new entity created as “Company Product”.
Note – If entity is not displayed, refresh page once
- Select “Company Product” entity and Click on Data tab to see imported data
Hi Sachin,
Would you mind give me a hand the following sceneario, please?
I am new working with CDS, I have created 2 entities there, when I used them at Powerapps Forms I noticed that I could assigned duplicates foreing keys into the entities.
So, thats mean that CDS does not validated this fields?
For example: I have a field at the form to create a unique code.
During the test I could created several items with the same code.
I’ll appreciate any comment.
Regards,
LikeLike
Hi Adrian, you can have duplicate foreign keys in entity but cannot have duplicate primary keys. Are you taking about primary key or foreign?
LikeLike
Thanks for your response.
Sorry for the mistake! The issue is with the current primary key field!
Could I send you a print screen?
LikeLike
Yes please..I will check and update you.
LikeLike
Hi Sachin,
I apologize for use this way, but I could not send a print screen througth your blog. As you can see I could insert multiples rows with the same value at the primary key field.
Regards,
El jue., 18 oct. 2018 a las 14:09, Bansal Blogs – Dynamics 365, PowerApps, Microsoft Flows, Power BI () escribió:
> Sachin Bansal commented: “Yes please..I will check and update you.” >
LikeLike
Hi Sachin,
I have to migrate one CRM application(8.2) which is completely based on Custom entities to PowerApps. Is there any way to import these entities in PowerApps directly or do I need recreate the entire set in PowerApps again? Its almost 45 entities.
You help is really appreciated.
Regards
Vrushali
LikeLiked by 1 person
Hi Vrushali, only way to quickly create entities in PowerApp is by exporting data from CRM for these entities and import excel in PowerApp. During import PowerApp automatically creates entity for you.
LikeLike
Hi Sachin
I believe you are talking about the data integration. This way I could create the entity from the excel. However for all the fields, the data type was created as multi-line text instead of actual field type. Am I missing anything?
Regards
Vrushali
LikeLike