If we want to use an action that will be generic and will perform an update operation on the entity where entity name and values are decided on runtime, then it is possible with Power Automate. We can make Update a row dataverse operation dynamic by providing the entity name, row ID and values at run time.
Create a new flow- Dynamic Update On Any Entity with manual trigger and three input parameters: Entity Name, Row ID, and Values.
Create Update a row action in Power Automate flow. For table name parameter- Instead of selecting a specific entity name from the dropdown, select Enter custom value option which is at the bottom of dropdown list.
Set trigger input as parameter Entity Name as value for Table name. Make sure this value is plural logical name of entity, thus added "s" at the end.
Similarly, set Row ID with the corresponding trigger input parameter.
For Row item, set Values parameter. This parameter should be a JSON object with key-value pairs of logical column names and corresponding values to be updated. We can only include columns that we need to update. Note that since the trigger input parameter is of type text and this action expects value to be JSON, we have explicitly converted it to JSON using JSON() function expression.
manually trigger flow with Entity Name as logical entity name, a valid row ID and JSON object with logical column name and value to be updated.
If all values are correct, then you will see that the flow ran successfully and the record is updated.
Here, we created a very basic flow to demonstrate dynamic updates on any entity. You can tweak this and unlock use cases as per need. You can create helper flows and call them from main process flows.
One of the use case that we had is- we wanted to update sharepoint url of a document to its corresponding record. As we had multiple entities uploading documents to sharepoint, we had used this type of flow wherein we identify the entity and pass that as parameter to this flow with url as value. This saved us from creating switch case with lare number of cases for each entity.
Hope, you find this useful, thanks for reading.
keep learning !