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
raseshtcsraseshtcs 

Javascript Error

Hi All,

 

I have created a List button on a custom Object with label Account and api name Account__c. The list button should create a record of another custom object and then redirect the user to create page of another object.

But on click of the button java script throws an error. DUPLICATE PREFIX : ACCOUNT

 

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

var cId= '{!Account__c.Id}';
var Org_Constant__c=new sforce.SObject("Org_Constant__c");
Org_Constant__c.Id__c = cId;
Org_Constant__c.Object_Type__c = 'Account';
Org_Constant__c.UserId__c = '{!$User.Id}';

var result = sforce.connection.create([Org_Constant__c]);

if (result[0].getBoolean("success"))
top.location.href = '/a07/e';
else
alert("Operation Failed " + result[0]);

 

The same logic needs to work for 3 more custom objects for which I have created the button and it is working fine. I also tried to write just an alert statement on click of the button, but I am getting the same error.

Please Suggest.

 

Alternatively I thought of creating a VF page to override the button instead of Javascript, but I am not getting the my VF page in the list there. Am I missing something there.

 

Thanks in Advance.

Rasesh