How To Do It
Hiding the Refresh button in BusinessObjects XI R2 Web Intelligence reports might seem like a troublesome feat at first, particularly because BusinessObjects does not provide a built in option to do it out of the box. It is not and is considerably very simple.
To do it, the editing of a simple JavaScript file is required. This JavaScript file is responsible for loading the default Web Intelligence viewer that is bundled with BusinessObjects XI R2. Special thanks goes out to cgarcesg at Forum Topics for his original idea.
As a quick look ahead, this is what the small modification will accomplish:
- Examine the URL query string and search for a specific parameter
- Based on the value of the parameter, taken an action to display or hide the Refresh button
Perform the following steps in order to apply the aforementioned modification:
- Locate a JavaScript file named viewer.js. This file will be located in the following directory:
[BOInstallDirectory]\Tomcat\webapps\businessobjects\enterprise115\desktoplaunch\viewers\cdz_adv\language\[BOLanguage]\scripts
Where [BOInstallDirectory] is replaced with the BusinessObjects root installation directory and [BOLanguage] is replaced with the installation language of BusinessObjects. - Prepend the following function to the top of the file. This function will be responsible for retrieving a query string parameter from the URL:
// Retrieve Query String Parameter From URL.
//
// Function courtsey of lobo235 at
// http://www.netlobo.com/url_query_string_javascript.html
//
// @param string name
// @return string
function gup( name )
{
name = name.replace( /[\[]/ , "\\\[" ).replace( /[\]]/ , "\\\]" );
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[ 1 ];
} - Scroll down in the file until you find the following code segment:
refreshDocIcon = addIcn(
"refresh" ,
7 ,
( bFullScreen ? null : "Refresh Data" ) ,
"Refresh data to return latest results from the database"
)
Replace it with the following code segment:( ( gup( "hideRefresh" ) == 1 ) ? refreshDocIcon = null : refreshDocIcon = addIcn(
"refresh" ,
7 ,
( bFullScreen ? null : "Refresh Data" ) ,
"Refresh data to return latest results from the database"
) )
How To Use It
To use the modification, simply open a Web Intelligence document using the openDocumentscript that is supplied by Business Objects. Append the following parameter to the URL’s query string in order to hide the Refresh button when the Web Intelligence document loads:
hideRefresh=1
So, for example, if you want to load a Web Intelligence document with an id of 1000 and with the Refresh button hidden, you would do so using the openDocument script in the following format:
http://[BOCMSName]:[BOCMSPort]/businessobjects/enterprise115/desktoplaunch/opendoc/openDocument.jsp?sType=wid&iDocID=1000&hideRefresh=1
Where [BOCMSName] is replaced with the name or the IP address of the BusinessObjects CMS you wish to connect to and [BOCMSPort] is replaced with the port the BusinessObjects CMS you wish to connect to is listening on for incoming connections.
Excluding the hideRefresh=1 parameter from the openDocument script will not make any changes and the Refresh button will remain visible. So feel free to ignore it in cases where you do not want the Refresh button to be hidden.
does this have any impact on the general functionalties.And what is the impact when we upgrade the BO environment.
ReplyDeleteHi,
ReplyDeleteThis modification will not have any impact on the general functionality of any WebI reports.
If you open up a WebI report from within InfoView normally, this trick will not work since you need to append a query string parameter, as described, in order for the refresh button to be hidden. The only way to make it work is to edit several other JSP files that make up InfoView.
What is the impact when you upgrade the BO environment? If the modified JavaScript file is replaced during the upgrade process, again this trick will cease to work until the JavaScript file is modified again in the upgraded environment.
But again there will not be any negative consequences. Reason being is that the modified script searches for a query string parameter and based on it it hides the refresh button. If the query string parameter DOES NOT exist, the refresh button will remain visible. If the script does not include the modification and query string parameter DOES exist, the refresh button will also remain visible either way.
In short, to make the upgrade process short and sweet, you need to ensure that the modification to the script is applied.
I should also add that I noticed a bug in the modification. Below is the proper modification and I have updated the article as well:
ReplyDelete( ( gup( "hideRefresh" ) == 1 ) ? refreshDocIcon = null : refreshDocIcon = addIcn(
"refresh" ,
7 ,
( bFullScreen ? null : "Refresh Data" ) ,
"Refresh data to return latest results from the database"
) )
Ahmed, Thanks for your quick reply.
ReplyDeleteYou are greatest person and this post is greatest post I came across.
ReplyDeletesimply Great post .. really great job!!!
ReplyDeleteI have two queries....
1.
changing only single viewer.js from following location will not work ?
[BOInstallDirectory]\Tomcat\webapps\businessobjects\enterprise115\desktoplaunch\viewers\cdz_adv\language\[BOLanguage]\scripts
2.
and if able to hide REfresh Button, what about "User Prompt Input" pane from left side ? it will be visible and from there user can refresh report. please correct me if i am wrong..
awaiting for ur reply ..
thanks in advance...
@Vilas Bhosale,
ReplyDelete1) I am not sure what you mean about changing a "single viewer.js". In general, you have to change "viewer.js" for every language that BO is accessible in by your users. If you can be more specific on what you need, I can help you out a little more.
2) The User Prompt Input pane on the left side WILL REMAIN visible as this trick will only hide the refresh button. But with a little extra work, you can also hide the pane itself.
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeletethanks Ahmed Elgarhy ...
ReplyDeleteactually, we hav requirement like... in detail report the Refresh button and user prompt input pane should not b there ...
tech: BO Xi 3.1 - Webi
I entered above code in my viewer.js, however after this my webi reports are not opening ...
is there will be change in code for BO XI 3.X..
if u could help me in this, that would be great help for me..
thanks
above code is talking about "Refresh" Button, what about "Refres All" button...
ReplyDeletehere please guide... and correct me if i wrong,
can u replace following line in same file
.....
refreshAllIcon=addIcnM("refreshAll",7,"Refresh All","Refresh data to return latest results from the database",clickCB,initRefreshAllMenu);
......
with the following code,
.....
(( gup("hideRefresh") == 1 )?refreshDocIcon=null:refreshAllIcon=addIcnM("refreshAll",7,"Refresh All","Refresh data to return latest results from the database",clickCB,initRefreshAllMenu));
......
please revivw above code and anyelse needs to change...
waiting for ur replay ..
thanks in advance ...
@Vilas Bhosale,
ReplyDeleteBO XI 3.1 requires a slighly different approach than BO XI R2. The code mentioned in this post applies ONLY to BO XI R2. I'll take a look at BO XI 3.1 and let you know the difference.
As for the Refresh All Button ... For BO XI R2, the same concept applies, just apply the same condition for the Refresh Button to the Refresh All Button and it too should be be hidden under the same circumstances. In short, if the code you posted is for BO XI R2, then you should have no problems.
Thanks Ahmed Elgarhy for your response ... :)
ReplyDeleteactually we have urgent requirement for BO XI 3.1.
basically we have requirement like we have to hide the Refresh/Refresh All button and left side user prompt pane for all reports for one specific user.
also above solution for all other users, i.e. disabling the Refresh/Refresh All and user propmt pane for only detail report (through hyperlinks)
If you could give ur help on these, would be great help for me ...
thanks in advance..
@Vilas Bhosale,
ReplyDeleteIf you can please clarify the following for me. You need to disable the Refresh/Refresh All Buttons and the Prompt Input Pane for only ONE user across ALL reports
AND
You need to disable the Refresh/Refresh All Buttons and the Prompt Input Pane for ALL users for only ONE report.
Did I understand you correctly?
If this is the case then this scenario is going to be quite difficult to accomplish. Reason being is that we are editing a simple JavaScript file that loads the report viewer on the client side. BO authenticates which user is logged in, along with their credentials, on the server side through the SDK.
It will be hard, if not impossible, to access server side code from the JavaScript file unless the JavaScript file itself defines an API that can manuiplate the report viewer after come conditonal logic we can preform using server side code.
I am going to need to check if this is possible and get back to you but if you are in a hurry the workflow for the process goes something like this in case you want to investigate yourself:
1) Get user currently logged in to BO
2) If user is User A, ask the report viewer to hide the buttons and pane.
3) Else If user is Not User A and Report is Report A, ask the report viewer to hide the buttons and pane.
This comment has been removed by the author.
ReplyDeleteThanks a lot Ahmed Elgarhy for ur valuable inputs...
ReplyDeleteIf you could help me on 2nd point as early as possible that will be great help for me..
i.e. on
2) If user is User A, ask the report viewer to hide the buttons and pane.
we are using BO XI 3.1
actually i am completely new for SDK customization.
awaiting for ur reply..
for 3rd point i .e.
3) Else If user is Not User A and Report is Report A, ask the report viewer to hide the buttons and pane.
we want to hide the Refresh/Refresh All Buttons and the Prompt Input Pane for only for detail report (opening through Hyperlinks) for all users
this can be achivable by the main solution of this post, however i m seeking same in BO XI 3.1
Thanks..
@Vilas Bhosale,
ReplyDeleteHave you considered setting security options for your users through the CMC? Certain security options can effectivley help hide both the Refresh/Refresh All Buttons and the Prompt Input Pane.
What you can do is create two Groups, one for users that you want to hide the refresh button for all reports and one for all users that you want to hide the refresh button for certain reports.
Place the reports in different folders, ie. a folder for summary reports and a folder for details reports.
Assign rights to each folder for each Group, ie. Group A does not refresh Folder A while it can refresh Folder B, and Group B is the opposite.
The security options you need to deny is the option to refresh a report's data. This is probably the easiest route and you don't have to play with the SDK to accomplish it.
But Ahmed Elgarhy ,.... if i restrict user on folder B (contains detail report), then we can't open detail report through the hyperlink, as it will say no access on detail report... i have tried this .. ;)
ReplyDeleteHi Vilas Bhosale, Have you tried to explicitly give the users access on the detail report? I think you should do that because reports inherit the rights of their parent folder by default.
ReplyDeleteHi Ahmed,
ReplyDeleteHow do we do it in BO 3.1 Sp2 version.
tks
@Anonymous,
ReplyDeleteI am sorry but I do not have BO XI 3.1 SP2 available to me in order to test how this can be applied for it. When and if I do, I will let you know.
Best of luck.