Comments after return in Client Method leads to 'event handler' error
Hi community, I discovered a strange behavior in Innovator 12. Let´s assume we have a regular Form with a button that uses the following onClick event: alert("This is just a test button event"); return; // Todo for later: add additional validation This Method will lead to the following error Message: 'Event handler' failed with the message: ReferenceError: func $ BD472BC271CA48E88DE6CB0C7E3CED75 $ _onclick2 is not defined I noticed that the Method works fine, as soon as I remove the comment behind the return. Of course in normal code we most of the time do not have any additional comments after the final return. But when creating new Methods, I often place later used code at the bottom so I can take care for it later. Comments after the return statement were never any problem in Innovator 11. It took me quite a few days until I finally discovered why certain parts of my new code never worked. Is there an explanation for this new behavior? Are there any other new design rules to consider when programming in Innovator 12? Would be happy about any hints to avoid similar effects! Thanks! AngelaSolved13KViews0likes10CommentsHow to call a client method from another client method?
Hello everybody. I have several client methods which are sharing some common code. I would like to put that code in a method, and call that method from the other methods, everything is client side. How can I do that?Solved5.8KViews0likes4CommentsTypeError: this.newItem is not a function - Client Side Error
I am attempting to run a Javascript/ client side method that calls other client method, and for some reason I am having a difficult time getting anything to work as I would expect. My confusion lies in many areas. The syntax check runs 'ok', no errors, but something tells me it is not working correctly (or at all) because it comes back with an OK immediately, no wait time. I am simply trying to grab an item of a particular name, grab it's ID, and hand that ID to a known, working method, that requires this item I am getting as the context item. var itemName = this.newItem("Itemtype", "get"); itemName.setProperty("name", "desired name"); itemName = itemName.apply(); var body = itemName.getID(); return innov.applyMethod("Second Method Name", body); When I run this from the intended run location (a button with an OnClick field event), I receive an error. My initial reaction is that, this.newItem is most certainly a function, and works both in server and client side code, not sure why this is the error. Very well could be something that I'm missing or not understanding. There is no other information in this error message, has anyone seen this before?5.3KViews0likes4CommentsEnable Spinner on field event method
Hello, I have a javascript method that is triggered on change of a field value. This method takes 20 - 30 seconds to run and I want to be able to display the Aras spinner but nothing seems to be working. I have attempted multiple solutions from other posts but none have solved the issue. I noticed in the core function below my value for spinnerEl is always null. If anyone could provide any help it would be appreciated. BrowserHelper.prototype.toggleSpinner = function (context, state, spinnerId) { spinnerId = spinnerId || 'dimmer_spinner'; var spinnerEl = (context.ownerDocument || context).getElementById(spinnerId); if (!spinnerEl) { return false; } spinnerEl.classList.toggle('aras-hide', !state); return true; };1.7KViews0likes1CommentTrigger Client Method on Relationship Replace
I have a client method defined to be triggered on an OnInsertRow event for the Part BOM relationship type. This method is not triggered when the user performs a Part BOM replace. The most likely reason for this is, when handling the replace Innovator is just doing an update of the Part BOM item. The Part BOM itemtype definition only allows OnBeforeNew, OnAfterNew, OnNew and OnShowItem client events. But these events are not triggered when doing a Part BOM replace. Is there any way to trigger a client method when doing a Part BOM replace?1.6KViews0likes2CommentsCMF Property Coloring
Hello, I'm working through the CMF guide, and attempting to implement the task in 4.1.9 (Set the text color for a given zone) for a real world use case. In my Innovator instance, I have a CMF Item Type called MyPQD, with two properties -- MyStringProp, and MyTextProp. (per an earlier example in the guide) I'm using the following code, but not having any luck getting the color to change. Any idea what I'm doing wrong here: var color = "#008000"; var innovator = aras.newIOMInnovator(); var myElement = innovator.newItem("MyPQD", "cmf_updateElement"); myElement.setProperty("Text", MyTextProp); // create cmf style object and set available styles var cmfStyle = innovator.newItem("cmf_Style"); cmfStyle.setProperty("text_color", color); myElement.setPropertyAttribute("MyStringProp", "style", cmfStyle.toString()); // you should set value of property directly, otherwise it will be updated to empty value // for this purpose we need to get existing element with property var existmyElement = innovator.newItem("MyPQD", "cmf_getElement"); existmyElement = existmyElement.apply(); myElement.setProperty("MyStringProp", existmyElement.getProperty("MyStringProp")); myElement.apply();1.5KViews0likes2CommentsHow can I trigger the classification to update and change forms from a different property?
Hi Aras Community, I have a use case where my classification is technically controlling two things. What type of workflow they are on and what kind of form they see with the ability to switch the different kinds of forms. I'm trying to prevent mistakes from happening by providing 2 drop downs one that shows the workflow type and another that offers the form options. On selecting the form options, I need to update the classification and have the form change to the proper form. My current code updates the classification but does not execute whatever code causes the form to change on the classification update the way it does if you type it in or use the classification dialog box. Below is the code I'm starting with I don't know if there may be an API I can call that does this change or if there is a way to refresh the iframe that I'm not aware of. Any help is greatly appreciated. [embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:21865118-1b9b-4636-b04c-3a80e379aacf:type=javascript&text=var%20inn%20%3D%20top.aras.newIOMInnovator%28%29%3B%0D%0Avar%20formtype%20%3D%20document.all%28%22form_type%22%29.value%3B%0D%0Avar%20worktype%20%3D%20document.all%28%22workflow_purpose%22%29.value%3B%0D%0Avar%20classification%20%3D%20%22%22%3B%0D%0A%0D%0Aswitch%28worktype%29%7B%0D%0A%20%20%20%20case%20%22New%20Work%22%3A%0D%0A%20%20%20%20%20%20%20%20if%28formtype%20%3D%20%22form1%22%29%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20classification%20%3D%20%22form1%2FCreate%20New%22%3B%0D%0A%20%20%20%20%20%20%20%20%7Delse%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20classification%20%3D%20formtype%2B%22%2F%22%2Bworktype%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20break%3B%0D%0A%20%20%20%20%0D%0A%20%20%20%20case%20%22Other%20Work%22%3A%0D%0A%20%20%20%20%20%20%20%20if%28formtype%20%3D%20%22form2%22%29%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20classification%20%3D%20%22form2%2FOther%20Work%22%3B%0D%0A%20%20%20%20%20%20%20%20%7Delse%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20classification%20%3D%20formtype%2B%22%2F%22%2Bworktype%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20break%3B%0D%0A%7D%0D%0A%0D%0Awindow.handleItemChange%28%22classification%22%2Cclassification%29%3B%0D%0Awindow.handleItemChange%28%22form_type%22%2C%20formtype%29%3B%0D%0A%0D%0Areturn%20this%3B]Solved197Views0likes2CommentsPrefill simple search criteria in the search grid
Hello, For Documents item type, in the search grid I need the "Classification" to be prefilled to "General" . I applied client side method to "classification" and "search_default" properties of Documents but it doesn't work. "search_default" property did not exist before so I just added it, I don't know if that makes a difference. method: return {classification:{filterValue:"General",isFilterFixed:false}};Solved0Views0likes8CommentsTrouble Exporting HTML Table to Excel in Aras Innovator Custom Button
Hello everyone, I've been working on a custom button within the search tab for parts in Aras Innovator. The goal is to export a list of specific parts and their properties through a query and display them in an HTML table. Here's a snippet of the code I'm using to convert the HTML table to Excel and download the Excel file: [embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:4ac1465e-c931-489c-a19e-bb242bc1c5f6:type=javascript&text=var%20htmlCode%20%3D%60%0A%3Chtml%3E%0A%3Chead%3E%0A%3Cmeta%20http-equiv%3D%27Content-Type%27%20content%3D%27text%2Fhtml%3B%20charset%3Dutf-8%27%20%2F%3E%0A%3Cscript%20src%3D%27https%3A%2F%2Fcdnjs.cloudflare.com%2Fajax%2Flibs%2Fxlsx%2F0.16.9%2Fxlsx.full.min.js%27%3E%3C%2Fscript%3E%0A%3Cscript%20src%3D%27https%3A%2F%2Fcdnjs.cloudflare.com%2Fajax%2Flibs%2FFileSaver.js%2F2.0.5%2FFileSaver.min.js%27%3E%3C%2Fscript%3E%0A%3Cscript%3E%0Afunction%20substituteTableToExcel%28%29%7B%0Avar%20table%20%3D%20document.getElementById%28%27all_Parts_AML%27%29%3B%0Avar%20sheet_name%20%3D%20%27ALL_Parts_AML%27%3B%0Avar%20workbook%20%3D%20XLSX.utils.table_to_book%28table%2C%20%7Bsheet%3A%20sheet_name%2C%20cellStyles%3A%20true%7D%29%3B%0Avar%20wbout%20%3D%20XLSX.write%28workbook%2C%20%7B%20bookType%3A%20%27xlsx%27%2C%20bookSST%3A%20true%2C%20type%3A%20%27array%27%2C%20cellStyles%3A%20true%20%7D%29%3B%0AsaveAs%28new%20Blob%28%5Bwbout%5D%2C%20%7B%20type%3A%20%27application%2Foctet-stream%27%20%7D%29%2C%20%27ALL_Parts_AML.xlsx%27%29%3B%0A%7D%0Adocument.addEventListener%28%27DOMContentLoaded%27%2C%20function%28%29%20%7B%0AsubstituteTableToExcel%28%29%3B%0A%7D%29%3B%0A%3C%2Fscript%3E%0A%3Clink%20rel%3D%27stylesheet%27%20type%3D%27text%2Fcss%27%20href%3D%27styles.css%27%3E%0A%3C%2Fhead%3E%0A%3Cbody%3E%0A%24%7BexcelTable%7D%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E%60%3B] return htmlCode; I'm encountering issues with the export functionality. When I click the custom button, the HTML table is generated correctly, but the Excel file download doesn't seem to work. Could someone kindly review the code snippet above and provide any insights or suggestions on how to troubleshoot and resolve this issue? I would greatly appreciate it. Thank you in advance! Version 12.0 SP8Solved0Views0likes2CommentsHow to use Visual Studio Code 2022 for Coding Methods
I am new to Aras development, and I'd like to use Visual Studio Code 2022 ("VS Code") for coding Innovator methods. I found the ArasVSMethodPlugin project on GitHub, and its change log indicates that support for VS Code 2022 was added in version 1.21. However, when I attempt to load the plugin using the .vsix file from the Aras Innovator Method Plugin on Open VSIX (which was updated 3 months ago), I get a message telling me that Code can't find a package.json file that its expecting. Details about the package.json file for a VS Code extension can be found on this Publishing Extensions page. I was wondering if anyone else was using VS Code 2022 for coding methods and if they might have any additional information about how to get it working. Thanks in advance for any/all assistance.0Views1like1Comment