cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NewcombR
Advocate IV
Advocate IV

Using CDS Alternate Keys in Flow

Am looking for a way to leverage the Alternate Key feature in CDS.

We have numerous CDS environments.
We have a core set of Contacts that we maintain in one environment. I have setup an alternate key on the Contact entity, and have been able to successfully import from an external source to the environment using the alternate key as a map.

However, we have numerous environments. Rather than having to maintain the contacts in all environments using the same import process, is there a way to use Flow to do this? eg if there is a new contact or a change to an existing Contact in the “Master” environment, a Flow should trigger to make the change in the other environments?

The GUIDS in the different environments are different, so I need to use Alternate key to map. I can’t seem to figure out how to get this working. Any help would be appreciated. Any ideas?
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @NewcombR ,

Do you want to use your AlternateKey field as the unique value in the action of "CDS Get Record"?

I'm afraid it's not supported to use custom AlternateKey field as the unique value in the action of "CDS Get Record" in flow currently.

In flow, the item identifier of "CDS Get Record" action could only be the record's guid.

Usually, the guid field is like this:

2172.PNG

Its data is like this:

2173.PNG

 While your Alternate Key field is text type, not the record's guid field.

So in your issue, I think using "CDS Get Record" is not suitable.

I agree with what he said @HSheild .

I suggest you use "List records" atcion instead. Configure List records-Filter Query to get the record.

Since your Alternate Key field is also a unique value in Entity, you could set this field to key.

Please note that since your Alternate Key field is text type, you need to enclose it in single quotes.

I've made a similar test for your reference:

ID is my Alternate Key field, not the guid field. To get the record by using ID field, I create the flow like this:

2174.PNG

 

2175.PNG

 

2176.PNG

 On your side, the filter query should be like: AlternateKeyfieldname   eq 'ID'

 

If the Alternate Key field value exists in environment2, then update record. If not, create a new record.

Here's a similar issue for your reference:

https://powerusers.microsoft.com/t5/Building-Flows/Using-Get-Record-Action-in-Common-Data-Service/td...

 

Also, if you want the item identifier of "CDS Get Record" action could be the custom field, you could post your idea here:

https://powerusers.microsoft.com/t5/Ideas/ct-p/PA_Comm_Ideas

If many people vote for your idea, this may come true in the future.

 

Best regards,

Phoebe

Community Support Team _ Phoebe Liu
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

11 REPLIES 11
HSheild
Most Valuable Professional
Most Valuable Professional

Hi

You can do this with Flow, take a look at an article I wrote on integration using Flow with Dynamics 365 (same as CDS and uses the CDS connector). Hopefully it helps.

https://dynamicscitizendeveloper.com/2019/06/06/microsoft-flow-csv-integration-with-dynamics-365/

With regards to the Alternate Key and looking up the Contact in the destination CDS, the Get Record action of the CDS connector does support Alternate Keys, just the GUID. You will need to use the List Records action and filter on the Alternate Key. There is a similar example in my article where a Currency lookup is done use the same method.

Thanks for your response... but I’m confused. You’re saying the Get Record does work for Alternate Keys, but only for GUID?

The alternate key I’m trying to use is a custom text field/column I added to the Contact entity. I configured the field as an alternate key.

Shouldn’t I be able to do something like this in a Flow Action?


Trigger:
When a CDS record is updated
Entity: Contact
Environment: myEnvironment1

Action
CDS Get Record
Entity: Contact
Environment: MyEnvironment2
ID: MyAlternateKey


In other words, if I don’t know the GUID of the record in the second environment, I should be able to use the Alternate Key using Get Record. Isn’t that the point of the Alternate Key?

Are you saying I need to instead use List Records and add a ODATA filter such as:

MyAlternateKey eq MyAlternateKey
HSheild
Most Valuable Professional
Most Valuable Professional

Hi @NewcombR ,

 

Sorry, that was a massive typo in my post!  I meant to say... Get Record does not work for Alternate Keys.

 

You have to use the List Records action as you have described.

It's frustrating to know that simple stuff like this not included in the CDS connector.

 

I proposed an idea in the community. Please upvote. 

https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Using-CDS-Alternate-Keys-in-Flow/idi-p/471843#M...

 

Hi @NewcombR ,

Do you want to use your AlternateKey field as the unique value in the action of "CDS Get Record"?

I'm afraid it's not supported to use custom AlternateKey field as the unique value in the action of "CDS Get Record" in flow currently.

In flow, the item identifier of "CDS Get Record" action could only be the record's guid.

Usually, the guid field is like this:

2172.PNG

Its data is like this:

2173.PNG

 While your Alternate Key field is text type, not the record's guid field.

So in your issue, I think using "CDS Get Record" is not suitable.

I agree with what he said @HSheild .

I suggest you use "List records" atcion instead. Configure List records-Filter Query to get the record.

Since your Alternate Key field is also a unique value in Entity, you could set this field to key.

Please note that since your Alternate Key field is text type, you need to enclose it in single quotes.

I've made a similar test for your reference:

ID is my Alternate Key field, not the guid field. To get the record by using ID field, I create the flow like this:

2174.PNG

 

2175.PNG

 

2176.PNG

 On your side, the filter query should be like: AlternateKeyfieldname   eq 'ID'

 

If the Alternate Key field value exists in environment2, then update record. If not, create a new record.

Here's a similar issue for your reference:

https://powerusers.microsoft.com/t5/Building-Flows/Using-Get-Record-Action-in-Common-Data-Service/td...

 

Also, if you want the item identifier of "CDS Get Record" action could be the custom field, you could post your idea here:

https://powerusers.microsoft.com/t5/Ideas/ct-p/PA_Comm_Ideas

If many people vote for your idea, this may come true in the future.

 

Best regards,

Phoebe

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

Thanks everyone.  I will try the suggestions of using list records. 

If I wanted to run the flow to check and update/create (“upsert”) multiple contacts, it seams that I would need to also do the following before the suggestions above:

 

  • List records in the “source” CDS environment
  • For each record in the Value list items...
  • Get the Record (in source environment environment)


and then apply the logic suggested above, to use List Items in the target environment, update/create condition, etc.  

 

 

Let’s say I have about 4K contacts in the Source environment...any concerns about the Flow timing out?  Would there be a way to improve the speed?

HSheild
Most Valuable Professional
Most Valuable Professional

Hi @NewcombR 

 

Your logic is about right but I wouldn't do the 3rd step as you should already have the source record from the first step.

 

As for bulk processing 4K records you will need to pay attention to the Power Platform API limits in consideration with other things that are processing data in CDS https://docs.microsoft.com/en-us/power-platform/admin/api-request-limits-allocations

 

To speed up the processing you can update the Concurrency Control setting of your Apply to each control.  This will process multiple records at once. See the Performance section of this article https://dynamicscitizendeveloper.com/2019/05/23/dynamics-365-integration-with-microsoft-flow/

 

The good thing about Power Automate is that it is really quick to configure so things like performance are quick to test.

@v-yutliu-msft 's suggestions and @HSheild 's recommendations worked like a charm on a series of tests I did, using progressively larger datasets (1, 100, 500).

 

I had placed a "cap" on the initial list of records from the source environment in the List Records query to Top Count.  

 

In my final test, I removed the "Top Count" cap... and was attempting to perform a full test with all of our contacts in the source environment.  However, for some reason the Flow completed in about 8 minutes.... but it only used 512 records?  Is there some hidden cap on the number of List Record items that can be processed?

Hi @NewcombR ,

Yes, the list records action has a limit of 512 records by default.

Could you tell me what is your license?

If you have per-user or per-flow license, you could enjoy additional capacity about CDS .(we can increase the limit up to 100000)

Other licenses could only have the limit of 512.

If you have per-user or per-flow license, you could change the limit here:

218.PNG

 

2181.PNG

 

By default, Pagination is off. Switch it on and adjust the limit.

As you can see above, the maximum limit is 100000( connector attempts to retrieve data in 512 record sets ).

 

To sum up, if you want to increase the default limit, you need to have premium plan and change the settings.

 

Here are docs about this for your reference:

https://powerofpowerplatform.com/cds-list-record-action-limitations-power-automate/

https://docs.microsoft.com/en-us/power-platform/admin/powerapps-flow-licensing-faq

(Please notice the P1 and P2 is previous version of premium plan. Currently, we use per-user or per-app plan.)

 

Best regards,

 

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

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (953)