Parent= Case Child = MyCustom__c

I have "New Cust" JS button on MyCustom__c related list - -> Now I go to my "Case" record (in Console) -> Go to related List "MyCustom" -> Click on"New Custom" Button

Throws following Errors

*Insufficient Privileges

You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. For more information, see Insufficient Privileges Errors.

Click here to return to the previous page.

What am I doing wrong here ? Any suggestions -

************ ** "New Custom" JS button code ************

var url = window.location.pathname; 
url = url.substring(1, url.length); 
var result = sforce.connection.query("Select Id, Description, AccountId, Account.Name from Case where id=\'"+url+'\''); 
var Desc = result.getArray("records")[0].Description ; 
var nullbool = (result.getArray("records")[0].AccountId != null ? "true" : "false"); 
if(nullbool == "true") 
var AccName = result.getArray("records")[0].Account.Name; 

I found one know issue here ---- but didn't understood much from there -



To analyse your issue, I created a button with exact code and it gave me the same insufficient privilege error.

I noticed that you are redirecting the user to create a new Case and URL looks like


But then I compared this URL with standard Case creation page with record type selection, it looks like


I have highlighted the "ent" parameter in both the URL and when I replaced the same in your code, it worked fine. Update your code to include updated ent parameter.


Just realised, that you probably redirecting the user to create another object. In that scenario, verify that

  1. You have create permissions for that object
  2. You have access to record types for that object.
| improve this answer | |
  • * I am creating child object record for case * Yes I do have permission on Object and access for the record Types too. * Do I need to change "ent= ?????" according to my child object ? – Salesforce Steps Dec 9 '15 at 10:42
  • 1
    Go to your child object tab and create new record. It will ask you to select the record Type. Just copy that ent parameter and replace in your code. – Salesforcesmarty Dec 9 '15 at 11:09
  • ent=01I400000006jOW this is the one ... I tried this by editing existing URL part ent=01I400000006gIa.... still ame error – Salesforce Steps Dec 9 '15 at 11:57
  • Just to confirm, if you set ent as Case, it is working fine for you as well, but not for the custom object, so that we can be sure there is nothing because of the URL? – Salesforcesmarty Dec 9 '15 at 12:12
  • Yes, If I set ent as Case it works , but if I do ent=01l400000006jOw i.e. for the Custom object then it does not work – Salesforce Steps Dec 9 '15 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.