In order to assign values and connect things together, it is recommended to use Model Links. Links can be activated on demand (using the enabled attribute), and manage values assignation for you, without the need to write script for simple data model connections.
Links are available for each type of object, with specific capabilities.