I have an existing Javascript button which causes "ActiveXObject is not defined" error when I click on it.

var newIRnAGenRequest = new sforce.SObject("Account");
newIRnAGenRequest.id = "{!Account.Id}";
newIRnAGenRequest.Request_Folder_Path__c = "{!Account.Request_Folder_Path_Hidden__c}";
newIRnAGenRequest.Req_Communication_Folder_Path__c = "{!Account.Req_Communication_Folder_Path__c}";
newIRnAGenRequest.Primary_Request_Status__c = "{!Account.Primary_Request_Status__c}";
var result = sforce.connection.update([newIRnAGenRequest]);

var myObject;
var myFile0 = "{!Account.Request_Folder_Path_Hidden__c}";
var myFile1 = "{!Account.Req_Communication_Folder_Path__c}";

if (newIRnAGenRequest.Primary_Request_Status__c == "Submitted") {
    alert("Please select a Primary Team assigned");
} else {
    myObject = new ActiveXObject("Scripting.FileSystemObject");
    if (myObject.FolderExists(myFile0)) {
    } else {
        var myObject2, newfolder;
        myObject2 = new ActiveXObject("Scripting.FileSystemObject");
        newfolder = myObject2.CreateFolder(myFile0);
        newfolder = myObject2.CreateFolder(myFile1);

When I try to google it, I found that it was related to files and it is dedicated to IE only. It worked few months ago in chrome. But now it stopped working everywhere.

My request is to provide any alternate solutions, if ActiveXObject can't be used anymore.

  • Please edit your post to include more detail and describe what the button is supposed to do. Remember that Salesforce is only supporting Microsoft Edge Chromium after Dec 2020. Commented Aug 30, 2020 at 19:00

1 Answer 1


Looks like to run this in chrome you need an extension named IE tab. This also has a prerequisite to use IE explorer which is going to be discontinued by Microsoft.

Looks like what you are trying to achieve is creating a file and folder in the local machine of the user. Note that secure of doing this is to generate a file on the server and then provide a download link to the user so it downloads to the user's machine.

Modern Approach

What you have today is a JavaScript Button which is no more supported by Salesforce due to security risks.

If you are in Salesforce classic still convert this to a Visualforce custom button.

For lightning, there is a number of alternatives like using quick actions and lightning actions using aura components. This is discussed in this module

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