Lightswitch Assign a Foreign Key a Value using Javascript RRS feed

  • Question

  • Hello

    I have a school database, and have defined two entities; student and classroom.

    A classroom has many students. In HTMLClient, I have successfully passed the Classroom ID from a previous screen into the screen below through ClassID.

    Now I would like to assign Student.Classroom to be ClassID using Javascript so that when the record is saved, it can be paired with that specific Classroom.

    In JavaScript, I have done the below:

    myapp.AddStudent.created = function (screen) {
        // Write code here.
        screen.Classroom = screen.ClassID;

    There is no problem with screen.ClassID; my problem is assigning that value to the Classroom attribute in the Student entity.

    Any ideas? Thanks!

    Tuesday, July 30, 2013 7:53 AM