Getting current user's group default view in javascript.

Trying to implement the suggestion in this post https://dundas.influitive.com/discussions/topics/58762?page=0.


On the document.ready event or the dundas.context.ready event I want to redirect to the default view.


Is there a way to get the default view of the current user's group and have js go to that page?

Is there more appropriate event to put this code in?


Thanks,

Matt

You can use the below scripts in the ‘javascript.override.js’ file that can be found [InstanceName]\www\BIWebsite\Scripts\Override.


In this script, you’d need to set the GUID of the group that the members should not see the Home page and also the Default view of the Group that the users should be redirected to.


In this script, I have set the URL manually, getting that from Dashboard -> Share -> Link, as I need to spend some more time investigating how to use the group's default view.

I will provide you with this script as soon as I have it ready.

-------------------------------*************************-------------------------------------

/* Add any JavaScript code to run in the site in this document */

debugger;

$(document).ready(function(){

window.dundas.context.ready(function () {

// To check the Seat Kind of the user logged on, you may uncomment the two following rows

// var seat = dundas.context.currentSession.seatKind;

// if(seat == "StandardUser") {

// Getting the Current session Group membership

var groupMemberships = [];

groupMemberships = dundas.context.currentSession.groupMembershipIds;

// Check if the GUID of that specific group exist in the array

// The GUID used in the script is the Group GUID

if (groupMemberships.length > 0 && groupMemberships.indexOf("<GUID of the Group>") > -1){

//Checks if the Page that is going to be opened is the Home page

if (window.dundas.context.currentPage == dundas.Pages.HOME) {

// Redirect the page to the desired URL from DBI

window.location.href = "<put the URL here>";

}

}

});

});

-------------------------------*************************-------------------------------------


As mentioned before, this will cause a flicker (the home page will still be loaded for a few milliseconds).

If this setting was going to be set for all users then you could use CSS override file to blank out the entire Home page, to avoid the flicker. However, to remove the flicker when redirecting only a group of users you would need a much more difficult solution that does not depend on Dundas BI API and attempts to check the URL manually.

spoiler alert - Dundas BI will handle this requirement with a simple property (no scripting) in our next major release - stay tuned