Create record and record of associated entity

Create record and record of associated entity

  
Hello, I have a record that we can call "Record" and also "Record_A" and "Record_B" and "Record_C" and "Record_D"

My database is setup like so
Record
            -> Record_AId
            -> Record_BId
            -> Record_CId
            -> Record_DId
What I want to do is when Record A is saved, then I will do something along these lines:
Record.new(Record_AId -> Id)
so I go into Interface -> mainflow/Record_A_Edit/Save
I drag a CreateOrUpdateRecord and put it below CreateOrUpdateRecord_A, and now I need to fill in source, but I cannot see anything I can fill in for source to accomplish this -- see capture.png

Hi Kevin,

It's simple :)

You only need to add a local variable in your action and set it as Record:


Then after the CreateOrUpdateRecord_A you need to set the Record_AId with the output of the create action.


If you do something like this, you will save a new Record at any time you save a Record_A.
You may pay attention to that because if you are only updating the Record_A you need to get the right Record and save it again, if you want.

Cheers,
José Ramalho

Way to go, José! That's a splendid reply!

Kevin, let me just complement José's answer with Service Studio's Online Help link at http://www.outsystems.com/help/servicestudio/7.0/Designing_Actions/Assign_Values_to_Variables.htm