set reference attributes of an object using Javascript

Hi, I have a domain model as shown in below. We can set the attributes of student by using  obj.set('Name','hello') . But how to set its reference, Say how can i set/assign the college name to the student using javascript . Could some one please help me with this? Thanks in advance.
1 answers

Do you need to use JavaScript? Using a Nanoflow would be a more Mendix way of doing this.


If you do need to do this using JavaScript then take a look at the addReference method of MxObject. That should let you set the association of a Student using the guid value of the College.


I hope this helps.