Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Use a rule to read information from the Google Sheet and populate the employee pick list. Here’s the relevant business rule:

Note

Escape the slash characters in your OAuth token with a backslash in the rule below like this: OAuth21\/\/<###...>


Code Block
languagejs
/*member employeeid, firstname, lastname, password, user, results*/

var x;

if (Connect.clicked) {
  var headers = {"user":"<google id>","password":"<access token>"};
  var readquery = '/google/spreadsheets/query/key/<your spreadsheet key>?wsname=<the name of your worksheet>';

    var results = http.get(readquery,headers);
    GSResults.value = results;
    eval('x=' + results);

    var opts = [''];
    if (x.results) {
        for (var i = 0; i < x.results.length; i++) {
            if (x.results[i].employeeid) {
                opts.push(x.results[i].employeeid + '=' + x.results[i].firstname + ' ' + x.results[i].lastname);
            }
        }
    }
    EId.options = opts;
}

...