locked
Startup parameter or data for home screen RRS feed

  • Question

  • I am trying to integrate a Lightswitch HTML application with an intranet. The app will appear in an iframe and have the users profile index passed to it in the URL.  Security is handled by the intranet so no forms authentication is needed. I do have to grab the users email address from the call and subset the information based upon those values so they can see their own data.

    I have in the screens create method hardcoded a screen parameter and found it works to retrieve the user information. However I have not been able to retrieve anything out of the URL in the create method and have it bind.

    When I call the browse screen with the normal parameter passing it works fine (ie not the home screen).

    Simple question has anyone found a way to pass a parameter or data to the screen create method from the URL or other means?

    Thanks!

    Konrad U

    Saturday, June 20, 2015 11:03 PM

Answers

All replies

  • Hello

    I dont particularly like just giving links as answers but as I am not 100% with the HTML Client I thougth it best to direct you to someone who is. Michael Washington has done a walkthrough that does include a lot of reading the querystring so should really help you on your way.

    http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/3274/Advanced-SharePoint-Workflows-Using-HTTP-Calls-To-LightSwitch.aspx

    HTH


    If you found this post helpful, please mark it as helpful. If by some chance I answered the question, please mark the question as answered. That way you will help more people like me :)

    • Proposed as answer by Otis Ranger Monday, June 22, 2015 1:44 PM
    • Marked as answer by Angie Xu Tuesday, June 30, 2015 7:38 AM
    Monday, June 22, 2015 1:44 PM
  • Thanks for the reference, the example seems to be more aimed at server side operations but I have found a client side solution that is generic java in the form created method:

    function getQueryParams(qs) {
            qs = qs.split('+').join(' ');

            var params = {},
                tokens,
                re = /[?&]?([^=]+)=([^&]*)/g;

            while (tokens = re.exec(qs)) {
                params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]);
            }

            return params;
        }

        var query = getQueryParams(document.location.search);
        screen.HWSRWCHCSRp = query.webaddy;
        screen.webidxp = query.webidxp;

    The only thing that threw me a bit was that the name of the url parm is appended to the query string so ?webaddy=XXXXX&webidxp=XXXXXX  parsed into the above variables.

    Wednesday, July 1, 2015 5:35 PM