Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Delete a row in SQL Server when Corresponding row in Dynamics 365 has been Deleted

I've created a flow that has a Dynamics 365 trigger for When a record is deleted, the Action off the back of this is SQL Server Delete row V2. 


When a row is then deleted from the contact entity in Dynamics 365 it attempts to delete the corresponding row in SQL. The error I get back is Resource not found, status code 404.


I understand the Row ID parameter on the SQL delete needs to be a primary key in the SQL table, which it is. The data type is set to a unique identifier too. With the Row ID set to Dynamic content and the ContactID field selected. I know there are two different contact id fields but I'm definitely selecting the same field as I'm using for an Insert using dynamics trigger and SQL Insert. 


All I'm using is the standard GUI on the flow site so I dont see how I can be going wrong, however I cant seem to find a way around the error, any suggestions more than welcome


Hey @ajludlow 


The when an item is deleted trigger, returns only the GUID of that particular record that is deleted. So, this record should exist in the SQL table too inorder to retrieve and identify the row that needs to be deleted. You can probably add a row to the SQL table named as rowidind365 and whenever a record is created in that entity in D365, setup a flow to copy the GUID of that record and update the row in SQL. That way, when the item gets deleted, it will be better to compare the GUID row and delete the corresponding item (makes sense?)


Hope this Helps!


If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hi @yashag2255 


Thanks for the reply, for the Delete trigger I'm already using the contactid field from D365, which is the unique GUID for the record. I'm also using this same field for another flow that creates an entry in the same SQL table, with the field named as ContactID, this field is also set as the primary key on the SQL table. With that in mind it should already be comparing like for like on the same field?

Helpful resources



Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (1,897)