What does SelectFile return?

Hello, I have what is probably a simple answer, but it is sure eluding me.  I am simply trying to process the return from SelectFile.  In this case I am loading it into a text field on the parent form.  Every sample I have found simply treats it as a returned var or string.  However, all I can see in the debugger and what gets returned into the text field is [object Object], so its an object not a string.  Am I supposed to do something else with it? Here is my onClick client method: var filePath = top.aras.vault.SelectFile(); if (filePath === undefined || filePath === ''){ return false; } //Set value on form element document.getElementById("MainDataForm").dataFile.value = filePath.toString(); //  also tried this:  document.getElementById("MainDataForm").dataFile.value = filePath; return this;
Parents
  • Hello, Depending on what version of Innovator you are using, this function could return different data. In recent versions, the SelectFile() function is asynchronous and returns a promise. If you want code to be reliant on the file selected, you will need to do something like below to specify that you want code to run after SelectFile() finishes running.
    top.aras.vault.selectFile().then(function (fileObject)
    { // The fileObject represents an unsaved file item. You can use it like below.
    var d = aras.IomInnovator.newItem("CAD", "add");
    d.setProperty("item_number", "007");
    d.setFileProperty("native_file", fileObject);
    d.apply();
    });
    Unfortunately, while it is possible to get the name of the file from the fileObject, it does not seem to be possible to get the path which the user selected. Chris
    Christopher Gillis Aras Labs Software Engineer
Reply
  • Hello, Depending on what version of Innovator you are using, this function could return different data. In recent versions, the SelectFile() function is asynchronous and returns a promise. If you want code to be reliant on the file selected, you will need to do something like below to specify that you want code to run after SelectFile() finishes running.
    top.aras.vault.selectFile().then(function (fileObject)
    { // The fileObject represents an unsaved file item. You can use it like below.
    var d = aras.IomInnovator.newItem("CAD", "add");
    d.setProperty("item_number", "007");
    d.setFileProperty("native_file", fileObject);
    d.apply();
    });
    Unfortunately, while it is possible to get the name of the file from the fileObject, it does not seem to be possible to get the path which the user selected. Chris
    Christopher Gillis Aras Labs Software Engineer
Children
No Data