Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8634817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:48:48+00:00 2026-06-12T09:48:48+00:00

So I have been working with Alfresco for a project I’m currently working on,

  • 0

So I have been working with Alfresco for a project I’m currently working on, and one of the newest requirements for the project is that I pull a sequence number from our Oracle database and populate a custom property within a space in Alfresco.

var conObj = new ActiveXObject('ADODB.Connection');
var connectionString = "Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=IP ADDRESS)(PORT=XXXX)))(CONNECT_DATA=(SID=your_SID)(SERVER=DEDICATED)));User Id=username;Password=pwd;"
                                conObj.Open(connectionString);

var rs = new ActiveXObject("ADODB.Recordset");
var caseID;

sql = "INSERT INTO case(mod_dt,mod_user) values(sysdate,’user’) RETURNING id"

rs.Open(sql, conObj);

caseID = rs(0);
logger.log("The new case id is: " + caseID);

rs.close;

However, this returned saying:

Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "ActiveXObject" is not defined. (workspace://SpacesStore/b3145512-e54d-4d9e-9655-0b6ae678e39b#141)

Which made me realize Alfresco’s Javascript API doesn’t have the full functionality of Javascript. I had read something about creating your own java class and calling them from within the Alfresco javascript, but I had not seen any good examples. Does anyone have experience with this or could they demonstrate a simple example of creating a java class to call from within Alfresco Javascript?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:48:50+00:00Added an answer on June 12, 2026 at 9:48 am

    ActiveXObject is an IE specific thing, it’s not available in non-IE browsers so it’s hardly surprising that it isn’t available in server-side JavaScript!

    As I understand it, you’re writing your JavaScript to be run as a rule, so it’ll be executed in the Alfresco Repository tier. That makes life slightly easier. What you’ll probably want to do is write some Java code that handles the connection and querying of Oracle, using Oracle’s Java APIs (JDBC or similar).

    When running in the repository, your JavaScript already has access to a large number of “root” objects, which can be used to perform a variety of operations on the repository. What you’ll want to do is inject your new Java class as an additional one, so it’s available for your rule script to use when it runs.

    (If you were writing a webscript, then you could just arrange to have the java object made available to the JavaScript model of your webscript. However, as you’re doing a rule, that’s not an option)

    To do that, have your new class extend BaseScopableProcessorExtension. Then, when you define a spring bean for it, set the extensionName property to control the name it appears in JavaScript as. There are quite a few examples in Alfresco itself you can look at for this, ScriptSiteSevice (bean id siteScriptService) is one that springs to mind.

    In case you’re new to spring and Alfresco, I’d suggest you either wrap your whole thing up as a module (AMP), or cheat a little and just drop the context file in a new alfresco/extensions directory under your tomcat shared classes. Your file would look something like:

    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
    <beans>
      <bean id="myOracleQueryBean" parent="baseJavaScriptExtension" 
            class="com.my.comany.namespace.alfresco.OracleScriptQuery">
        <!-- What it should be called in JS -->
        <property name="extensionName">
            <value>oracleQuery</value>
        </property>
        <!-- Inject any other things that your bean needs here -->
        <!-- eg some Oracle stuff from Spring -->
    </bean>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a project that displays data in an XML file.
I have been working on a C++ project that links to a .so(dynamic library)
I have been working on one project which is too complex and contain very
I have been working with a string[] array in C# that gets returned from
I have been working on a project where I send strings from a client
I have been working on a project in Eclipse that requires me to open
I have been working around one small project which needs a similar GUI as
I have been working with SQL Server as a Developer a while. One thing
I have been working on a project in C# (.net4). Project pretty much allows
I have been working on a project on and off, but I haven't touched

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.