web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Flow to send records w...
Power Automate
Unanswered

Flow to send records with different numbers of fields to Azure Cosmos DB

(0) ShareShare
ReportReport
Posted on by 2

If anyone can please help me with an issue building a flow to send a collectiion to Azure Cosmos DB.  The flow is giving me errors involving the final step and seems to be related to the partition key. The detailed current description and steps are below.

 

In the Powerapp I have an edit form that currently saves to to a relational SQL.  At the same time I Want to write each record update to a non-relational database to track the update history of all records. 

 

Step 1.  In the powerapp here is my code to send the data to a flow.  It combines the edit form and a UserID from another screen.  Then it converts the item to a JSON.  The last line is writing to the relational database and resetting the form.  This is an OnSelect feature of a button.

 

 ClearCollect(TranscribersAudit,TranscribersForm.Updates,{UserID:""});
 Patch(TranscribersAudit,Last(TranscribersAudit),             {UserID:TextInputUserName.Text});NoSQL.Run(JSON(TranscribersAudit,JSONFormat.IgnoreBinaryData));

SubmitForm(TranscribersForm);Refresh(Transcribers);

 

Step 2.   The flow receives the object, parses it as a JSON, and then goes to Azure Cosmos DB Create or update document connector.  I can actually pass straight from the powerapp to Azure Cosmos DB with or without a parse JSON just using the "body" of the powerapp connector.  I assume I can since I convert to JSON in the powerapp this works fine.    

 

RWoodward_0-1628780360735.png

RWoodward_1-1628780411062.png

RWoodward_3-1628780578108.png

 

 

The error I get is Message: {"Errors":["The partition key supplied in x-ms-partitionkey header has fewer components than defined in the the collection."]}.  

I have tried several inputs for the partiton key.  My container partition key is "/UserID" in Azure cosmos and my intent is to have a user ID in every record even though the number of elements in a record will change depending on the edit form I am sending from the powerapp.  Hence the {} in my parse JSON Schema.

 

If someone could help me with my flow to understand the syntax needed from the partition key.  I'm assuming I need to pass the User ID from my ParseJSON step with a statement to extract the value from {"UserID":""}

 

 

 

 

Categories:
  • Zap1798 Profile Picture
    8 on at

    I'm having this issue also. Have you found a fix?

  • RW-31071650-0 Profile Picture
    2 on at

    No on has responded yet. I also checked with Microsoft support and they couldn’t help me. 

  • Zap1798 Profile Picture
    8 on at

    I actually found the fix. Try using the newer version of the Create or Update Document action (V2). It worked for me as I supposed the older version was outdated. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 445

#2
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 300

Last 30 days Overall leaderboard