1

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

Code used:

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} 

var newRecords = []; 

var existingRecordType = "{!Case.RecordType}"; 
var c = new sforce.SObject("Case"); 
c.Id ="{!Case.Id}"; 
c.OwnerId="{!User.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.RecordTypeId=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.RecordTypeId=Id1; 
c.Status = "In Process"; 
} 
} 

newRecords.push(c); 

result = sforce.connection.update(newRecords); 

window.location.reload();

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

0

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

Here is a detailed tutorial on setting this directive.

http://www.html5rocks.com/en/tutorials/security/content-security-policy/

2
  • 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 Commented Jan 12, 2016 at 17:13
  • Here is the essential part: Try setting: Content-Security-Policy: script-src 'self' Commented Apr 13, 2016 at 21:23

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.