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

Community site session details

Session Id :
Power Automate - Using Flows
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":""}

 

 

 

 

I have the same question (0)
  • Zap1798 Profile Picture
    8 on at
    Re: Flow to send records with different numbers of fields to Azure Cosmos DB

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

  • RW-31071650-0 Profile Picture
    2 on at
    Re: Flow to send records with different numbers of fields to Azure Cosmos DB

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

  • Zap1798 Profile Picture
    8 on at
    Re: Flow to send records with different numbers of fields to Azure Cosmos DB

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 650 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 341 Moderator

#3
developerAJ Profile Picture

developerAJ 256

Last 30 days Overall leaderboard

Featured topics

Restore a deleted flow