I have created a custom button with some custom code , Although it is not working as designed:

Code used:


var newRecords = []; 

var existingRecordType = "{!Case.RecordType}"; 
var c = new sforce.SObject("Case"); 
c.Id ="{!Case.Id}"; 

if (existingRecordType == "Queue") { 
var result = sforce.connection.query("Select Id From RecordType where name='Accept' "); 
var records = result.getArray("records"); 
if(records.length > 0){ 
var Id = records[0].Id; 
c.Status = "In Process"; 
if (existingRecordType == "Internal Case - Queue") { 
var result1 = sforce.connection.query("Select Id From RecordType where name='Internal Case' "); 
var records1 = result1.getArray("records"); 
if(records1.length > 0){ 
var Id1 = records1[0].Id; 
c.Status = "In Process"; 


result = sforce.connection.update(newRecords); 


This button is designed to change the case owner

I am getting the following error in chrome console [Report Only]

Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src https: 'unsafe-inline'".

1 Answer 1


Try setting: Content-Security-Policy: script-src 'self'

Here is a detailed tutorial on setting this directive.


  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – Himanshu
    Jan 12, 2016 at 17:13
  • Here is the essential part: Try setting: Content-Security-Policy: script-src 'self'
    – Kirk B
    Apr 13, 2016 at 21:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .