This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Is there a mistake in "Aras Innovator Programmer's Guide" Example 7.28?

[email protected] - Friday, August 13, 2010 5:19 AM:

Example 7.28 Code List:

// Prompt the user for the file name and retrieve the File item
var fileName = prompt("Enter the File Name:","");
var innovator = this.newInnovator();
var fileItem = innovator.getItemByKeyedName("File",fileName);
if (fileItem.isError()) {
top.aras.AlertError("File Not Found: " +fileItem.getErrorDetail());
return;
}
// Get the URL to the file and download it
var fileURL = top.aras.getFileURLEx(fileItem.node);
var folder = top.aras.vault.GetWorkingDir();
var results = top.aras.vault.downloadFile(fileURL);
if (!results) {
top.aras.AlertError("Unable to retrieve the file from the vault");
return;
}
// Open the file in Word.
try {
var word = new ActiveXObject("Word.Application");
word.visible = true;
word.documents.open(folder + "\" + fileName);
} catch(e) {
top.aras.AlertError("Unable to launch Word. File saved as: "+folder+fileName);
return;
}

When after I have printed these codes in a new client-method, ran this method.But there is a mistake called: The method "OpenWordFile" failed.aras_object: "-2146232828" : "Target Exception:" Client Side Error....



Yoann Maingon - Friday, August 13, 2010 5:33 AM:

Are you running Innovator 9.2 ?

can you debug it and run the program step by step to know where the issue is raised?



[email protected] - Tuesday, August 17, 2010 1:48 AM:

I have found this problem because I used a button to trigger  a method.
"this" in method will be given as ui.button.
so we should replace "this" of "document.thisItem.xxxxx"

 

Thank you all.



[email protected] - Friday, August 13, 2010 9:50 AM:

Yes,I am running 9.2.
Having tried steps,the problem is still in this stack of codes.
var innovator = this.newInnovator();--this code sentence may be not working in Javascript Language..