0

I have a web page where you can open a Imanage document using a Active X control. The code works fine the first time I click the button (that launches the js code), but any time after that I get a undefined error description.

The openImanageDoc is the method that opens the document. I have other applications that is using the control without the error.

 <object id="Control" classid="clsid:*GUID*" codebase="*CONTROL*.cab"></object>

function getDocument() {

    try {
        var docNum = document.getElementById("docNum").value;
        var versionNum = document.getElementById("versionNum").value;
        var database = document.getElementById("database").value;



        var obj = document.Control;
        if (obj) {
            obj.openImanageDoc(docNum, versionNum, *SERVERNAME*, database, false);
        } else {
            alert("Object is not created!");
        }
    } catch (ex) {
        alert("Some error happens, error message is: " + ex.Description);
    }
}

I tried running the code in Chrome as well, the error that returns is:

obj.openImanageDoc is not a function

Many Thanks

William James
  • 67
  • 1
  • 16
  • ActiveX is only supported by IE. – Ismail RBOUH Aug 03 '16 at 15:31
  • Which variable comes back undefined? Maybe the Control gets overwritten or something after opening. Do you got more info on the API that Control uses? Do you maybe have to close the doc again before opening a new one? Just guessing here without more info. – Shilly Aug 03 '16 at 15:38
  • @Shilly the debugger hits the obj.openImanageDoc and then jumps to the catch alert message at the bottom. I have closed the document, which didn't change the outcome. I am presume that because it works the first time, could the object not be disposed of properly before the next click event? thanks – William James Aug 03 '16 at 16:02
  • 1
    Would it be worth bypassing the need to open the document via an ActiveX control and allow the document to be opened natively on the user's desktop by making an IWL: formatted hyperlink on your web page instead? – G Davison Aug 03 '16 at 18:51
  • @GDavison has the right approach in my opinion: if you want to open an iManage document from your web application you should make use of the IWL URI scheme. This scheme is supported since at least iManage client version 8.5 SP3. This way you just need to construct a regular HTML anchor element, with the href attribute set to the IWL URI. For example,My document – fivetoniner Aug 05 '16 at 14:51

0 Answers0