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.
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 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.
No on has responded yet. I also checked with Microsoft support and they couldn’t help me.
I'm having this issue also. Have you found a fix?