Before Efficy 11 indeed the entity and key of the newly created entity is added by Efficy.dll to the CreateRelation() call.
For example, if the action passed to the edit window for the new Property (entity 'Prop') is
then committing the new property will generate the script call
CreateRelation is a generic method to create a link or relation between two entities. It can handle the case in which the user needs to modify some fields in the relation (e.g. as in linking a Contact to a Company), or the case in which you need to open an edit window of another entity to create the relation (e.g. as in linking a Company to a Document).
The method to use is specified in the CreateRelationMethod (which can be overridden in custom). For a standard entity-entity relation in a treeview the default method is "2" and a call to the function AddLink is made.
So in the end we have the following call:
which generates the following call on the web server
var URL = "addlink?bookmark=1005&entity=Prop&key=60785&detail=Prop&detailkey=KeyOfNewProperty
Can you verify in the Efficy log that you get this call, with the correct parameters?
At the end of the day you should find a record in the database with KPROPERTY=60785 and KPROPERTY2=KeyOfNewProperty
In your testing environment apparently at some point the keys are swapped, and you end up with the opposite relation. I hope the information above will help you to find out at which point exactly the parameters are swapped.