Why is there are so many hacks involved in CreateOrUpdate action?

Few members suggested me to try out the CreateOrUpdate action. I had opportunity on today to try it out. Turns out there are so many hacks/tricks involved in this action to make it work for complex scenarios.

I created a data structure called "CreateTask" and the data structure has it own sub-data structure called ("SubData") then linked the sub-data structure using a list data-type. 

Now, I created an exposed Rest API and added an input parameter called "Create" and set data type as "CreateTask". 

Then, I simply dragged the CreateOrUpdate action to flow and tried to set the source of action to the data structure "CreateTask" but it turns out that the source of action must have a data type that equals to the table data not the data structure data...

Afterwards, I found about JSONSerialize and JSONDeserialize  actions and thought these actions might be the ultimate solution and I dragged these actions to flow and I was able to select JSONDeserialize  as the source of action on the CreateorUpdate action.

This trick did work, however the JSONDeserialize was not able to catch the sub-data structure instead it only catch data from the main data structure so I had use an action called "Assign", with "Assign" I was able to define the Sub Data Structure variables and set it data.

So here I don't see why should I use CreateOrUpdate when I can simply use SQL to write elegant query without all these hacks. Some hacks like JSONSerialize don't even make any sense to me because it trying to Serialize as JSON that's already Serialized.

Since I have many-to-many relationship type tables on the database. It would take a long flow to create new data in many tables using CreateOrUpdate action..




 

Solution

Hello Daniel,

You can use any variable of type Record / Structure as the source for the CreateOrUpdate action. If it does not match the data type expected, it will ask you to do a "mapping" between the data type expected and the one provided.

You can also use the "+" sign at the side of the parameter (in the CreateOrUpdate action) and define the values for each one of the required attributes without the need to provide a record variable.

Hope this helps.

Cheers

Solution

Eduardo Jauch wrote:

Hello Daniel,

You can use any variable of type Record / Structure as the source for the CreateOrUpdate action. If it does not match the data type expected, it will ask you to do a "mapping" between the data type expected and the one provided.

You can also use the "+" sign at the side of the parameter (in the CreateOrUpdate action) and define the values for each one of the required attributes without the need to provide a record variable.

Hope this helps.

Cheers


It works