cancel
Showing results for 
Search instead for 
Did you mean: 
iburiak
Sisense Team Member
Sisense Team Member

Script to retrieve the user list with first name and last, email, and userID. 

By following these instructions, users can efficiently check and download a CSV file containing the list of users meeting specific criteria from the developer console in their preferred browser under the user with Admin rights.

Google Chrome:

  • Open Developer Console:
    • Right-click anywhere on the webpage.
    • Select "Inspect" from the context menu.
    • Navigate to the "Console" tab.
  • Run Script:
    • Copy and paste the following script into the console

// Paste your script here

  • Execute Script:
    • Press Enter to execute the script.
    • Wait for the script to run and display the user list in the console.

Safari:

  • Open Developer Console:
    • Go to Safari Preferences.
    • Under the "Advanced" tab, check "Show Develop menu in menu bar".
    • Open the webpage where you want to run the script.
  • Access Developer Tools:
    • In the menu bar, click "Develop".
    • Select "Show JavaScript Console".
  • Run Script:
    • Copy and paste the script into the console.
  • Execute Script:
    • Press Enter to run the script.

Internet Explorer (Edge):

  • Open Developer Console:
    • Press F12 to open Developer Tools.
  • Navigate to Console:
    • Click on the "Console" tab.
  • Paste and Run Script:
    • Copy and paste the script into the console.
  • Execute Script:
    • Press Enter to execute the script.

Important Note:

Replace the placeholder comment // Paste your script here with the actual script that retrieves the user list based on your specified criteria. 

 

 

const INSTANCE_URL = 'https://example.sisense.com/'; // Example
$.ajax({
  url: `${INSTANCE_URL}/api/v1/users`,
  method: 'GET',
  success: (users) => {
    const allUsers = users.map((user) => {
      return {
        email: user.email,
        _id: user._id,
        firstName: user.firstName,
        lastName: user.lastName,
        lastActivity: user.lastActivity,
      };
    });
    console.table(allUsers);

    const csvData = allUsers.map((user) => Object.values(user).join(',')).join('\n');
    const filename = 'all_users.csv';
    const blob = new Blob([csvData], { type: 'text/csv;charset=utf-8;' });

    if (navigator.msSaveBlob) {
      navigator.msSaveBlob(blob, filename);
    } else {
      const link = document.createElement('a');
      if (link.download !== undefined) {
        const url = URL.createObjectURL(blob);
        link.setAttribute('href', url);
        link.setAttribute('download', filename);
        link.style.visibility = 'hidden';
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
        URL.revokeObjectURL(url);
      }
    }
  },
  error: (xhr, status, error) => {
    console.error(`AJAX request failed: ${error}`);
  },
});

 

Disclaimer: This blog post contains one possible custom workaround solution for users with similar use cases. We cannot guarantee that the custom code solution described in this post will work in every scenario or with every Sisense software version. As such, we strongly advise users to test solutions in their environment before deploying them to ensure that the solutions proffered function as desired. To avoid doubt, the content of this blog post is provided to you "as-is" and without warranty of any kind, express, implied, or otherwise, including without limitation any warranty of security and or fitness for a particular purpose. The workaround solution described in this post incorporates custom coding, which is outside the Sisense product development environment and is, therefore, not covered by Sisense warranty and support services.

Version history
Last update:
‎01-18-2024 08:11 AM
Updated by:
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]

Share this page: