Lightswitch HTML Client javascript - need to pass foreign key value to next screen RRS feed

  • Question

  • Hi,

    I need to build a simple application with a couple of screens that will be a add-on to an existing application. Users need to add data via a tablet. Hence LightSwitch HTML.

    The usergroup for access rights is in the existing application. A view provides the username, usergroupID (apptenID). The view is V_UserGroups and is on the home-screen.

    From a home screen a user needs to add a new 'building location'. So there is a AddEditBuildingLocation-screen. The building-table has a foreign key with the usergroupID (apptenID). This key needs to be passed from the home-screen to the AddEditBuildingLocation.

    I've been struggling a couple of days to get this to work properly, but I can't make it work. Looked at http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/1196/Visual-Studio-LightSwitch-Screen-Navigation-and-Advanced-JavaScript-Examples.aspx (and the MSDN site with similar code). Love that site!

    Below is my code. The beforeshown is right. The screen opens uneditable (greyed out). Any one of help?

    myapp.Home.AddBuilding_Tap_execute = function (screen) {

        myapp.showAddEditBuildingLocation(null, {

            beforeshown: function (addNewScreen) {

               var copied_item = screen.V_UserGroups.selectedItem.apptenID
                var new_item = new myapp.Building();
                new_item.AppTenID = copied_item
                addNewScreen.BUilding = new_item;


    Friday, June 6, 2014 8:31 AM

All replies