function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
llisallisa 

Javascript Button only works for my login in sandbox,for others it throws error

Hi,

I have a weird issue in my sand box.
I had wrote a javascript custom button to open a tab in primary tab.But the weird  thing is this code only works in my Login only,for others in the same sandbox it throws error

 "Unable to Access Page
You are missing information needed by the page you have attempted to access. If you believe this is an error, please refresh your screen. If the error persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information. "

Javascript code :

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
{!requireScript("/soap/ajax/29.0/apex.js")} 
{!REQUIRESCRIPT("/xdomain/xdomain.js")} 
{!REQUIRESCRIPT("/support/console/33.0/integration.js")} 

var url = "{!$Setup.Product_Complaints_ObjectId__c.ObjectID__c}"; 
if (typeof(srcSelf) == 'function') { 

sforce.console.openPrimaryTab(null, '/setup/ui/recordtypeselect.jsp?ent='+url+'&q_lkid={!Case.Id}&retURL=/a6z/o&save_new_url=/a6z/e?retURL=/a6z/o', true, 'New Product Complaint', openSuccess, 'salesforceTab');
var openSuccess = function openSuccess(result) {};  
}else{ 
window.open("/setup/ui/recordtypeselect.jsp?ent=01IM0000000A31h&q_lkid={!Case.Id}&retURL=/a6z/o&save_new_url=/a6z/e?retURL=/a6z/o","_blank"); 
}

In If part i fetch the id from a custom setting (didn't work for other user in sandbox except me),in else part id is hardcoded (Works for all the users in sandbox).
Best Answer chosen by llisa
GauravGargGauravGarg

Hi Lisa,

Thanks for enlighten me on Hierarchial Custom setting. 
Yes, we could only use hierarchial custom setting in Custom Button, but we are still able to add one default record that will be visible to org wide i.e. irrespective of profile or user. 
Please follow below steps to create default record in Custom Setting.
1. Firstly check the custom setting is protected or Public. If it is protected, please change it to public.
2. Click on manage.
3. Under default org Level value create new record. 

Please try follow above steps, hope this will helps you. 

Thanks,
Gaurav
Email: gauravgarg.nmims@gmail.com

All Answers

GauravGargGauravGarg

Hi Lisa,

We have two type of Custom Setting in salesforce:
1. List type: which is universal to all, i.e. anyone can access it.
2. Hierarchial: this custom setting will be access based on user permission. 

Please check if the custom setting is of "List Type", else it will not be accessible by other users in any org. 

Hope this will solve your problem, in-case you still face issues contact me on below details.

Thanks,

Gaurav
Email: gauravgarg.nmims@gmail.com

llisallisa
Hi Gaurav,

Thanks for your reply. I used Hierarchial custom setting in my button .
Actually previously i used List and it throws error "There was an error communicating with the server." ie an internal server error.
I went through some forum and it says we can use only Hierarchial custom setting in javascript button onclick.

Plz suggest me what should i do here ?



 
GauravGargGauravGarg

Hi Lisa,

Thanks for enlighten me on Hierarchial Custom setting. 
Yes, we could only use hierarchial custom setting in Custom Button, but we are still able to add one default record that will be visible to org wide i.e. irrespective of profile or user. 
Please follow below steps to create default record in Custom Setting.
1. Firstly check the custom setting is protected or Public. If it is protected, please change it to public.
2. Click on manage.
3. Under default org Level value create new record. 

Please try follow above steps, hope this will helps you. 

Thanks,
Gaurav
Email: gauravgarg.nmims@gmail.com

This was selected as the best answer
llisallisa
Hi Gaurav,
Thanks a lot ,it works :)
GauravGargGauravGarg
Welcome Mona :)