Access to list of Role ID numbers?

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

Hi,

I wish to create API buttons to Provision Users, but need access to the Role ID numbers. I know one can hover over the role and see the URL with role id in the bottom browser bar. Is there a way to export or grab the list of Role IDs?


Thanks,

Christopher

Photo of Chris

Chris

  • 4,430 Points 4k badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,604 Points 20k badge 2x thumb
Use the gimmeAllTheDatas technique and the code in the pastie below:

Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=509

What is Gimme All The Datas?
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=494
Photo of Chris

Chris

  • 4,430 Points 4k badge 2x thumb
Lovely! 
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,604 Points 20k badge 2x thumb
Share the loveliness with a better screenshot!

I also have a companion technique called submitmeAllTheForms which automates any form submission using similar constructs.
Photo of Chris

Chris

  • 4,430 Points 4k badge 2x thumb
click it!
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,604 Points 20k badge 2x thumb
It isn't a clean image - it doesn't show all the code and there is a big white rectangle obscuring the output.
Photo of Chris

Chris

  • 4,430 Points 4k badge 2x thumb
Here is the code. I placed it a user defined page.

<html>
<head>
<script>
var gimmeAllTheDatas = function(url, fn) {
  return $.Deferred(function(dfd) {
    $("<iframe>", {src: url})
      .appendTo("body")
      .one("load", function() {
        var data = fn(this.contentWindow, this.contentDocument, this.contentDocument.documentElement.outerHTML);
        dfd.resolve(data);
        $(this).remove();
      });
  }).promise();
};

var url = "main?a=myqb";

gimmeAllTheDatas(url, function(win, doc, src) {
  return _.map(win.input.appsListData, function(app) {
    return {dbid: app.dbid, name: app.name};
  });
}).then(function(data) {
  console.log(JSON.stringify(data, null, "  "));
});

gimmeAllTheDatas(url, function(win, doc, src) {
  return $("#appsListTable1 tr:gt(0)", doc).map(function() {
    return $("td:eq(2) a span", this).text();
  }).get();
}).then(function(data) {
  console.dir(data);
});

gimmeAllTheDatas(url, function(win, doc, src) {
  var countVowels = 0;
  src.replace(/<!--(.|\s)*?-->/gm, function(p0) {
    var matches = p0.match(/[aeiou]/gi);
    if (matches !== null) {
      countVowels += matches.length;
    }
  });
  return countVowels;
}).then(function(data) {
  console.log("Total number of vowels within HTML comments = " + data);
});
</script>
</head>
</body>
</html>
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,604 Points 20k badge 2x thumb
You didn't include a copy of jQuery which the script requires.
Photo of Chris

Chris

  • 4,430 Points 4k badge 2x thumb
I had thought that the JQuery that QB loads by default would have taken care of that. I'll revisit this.