How to call a server method with applyMethod() from a client method, and use the results coming back from server
Server Method : [Get_Identity_Details] Can run this and get results I want. Hard coded guid for test Innovator inn = this.getInnovator(); string sessionuserid = this.getProperty("sessionuser","invalid"); if (sessionuserid == ""){} StringBuilder sql = new StringBuilder(); sql.AppendLine("SELECT ID,KEYED_NAME FROM [ArasDev].[innovator].[IDENTITY] WHERE CLASSIFICATION='Group' AND ID in "); sql.AppendLine(" ( SELECT SOURCE_ID from [ArasDev].[innovator].[MEMBER] where RELATED_ID in"); sql.AppendLine("( SELECT ID FROM [ArasDev].[innovator].[IDENTITY] WHERE CLASSIFICATION='Role' AND ID in"); sql.AppendLine("( SELECT SOURCE_ID from [ArasDev].[innovator].[MEMBER] where RELATED_ID in"); sql.AppendLine("(SELECT RELATED_ID from [ArasDev].[innovator].[ALIAS] where SOURCE_ID='<USER GUID>'"); sql.AppendLine("))))"); Item results = inn.applySQL(sql.ToString()); return results; ======================================= Client method : calls the server method. Can see the result in debug from server method, but it does not work after that. How to make use of the results from server method? var inn = new Innovator(); var userid = inn.getUserID(); var itemTypeDropdownComponent = getFieldComponentByName("owned_by_id"); var itemTypeDropdownList = []; var body = "<sessionuser>" + userid + "</sessionuser>"; var res = aras.applyMethod("NOV_Identity_Details",body); if (res.isError()) { aras.AlertError(res); return; } else if (res.getItemCount() === 0) { //do something } else { for (var i=0;i<res.getItemCount();i++) { var currentItem = res.getItemByIndex(i); itemTypeDropdownList.push({label: currentItem.getProperty("KEYED_NAME"), value: currentItem.getProperty("ID")}) } } itemTypeDropdownComponent.component.setState({ list: itemTypeDropdownList }); return null;13KViews0likes4CommentsShow form on promote
Hi, Usecase is as follows need to validate field on promote if case of failure need to popup form(existing) and capture user input. for validation, i tried with pre server method on lifecycle but popping up form not possible from server method. Is there a way to achieve this? Any suggestion/work around would really help ThanksSolved13KViews0likes8CommentsHow to color grid cells according to properties that are hidden in grid?
Hi Community, I hope somebody can give me some hints to solve the following use case. I use an onAfterGet Server Method in ItemType Part that colors certain columns like ‘state’. Now I want to add some color to an additional property that contain the ERP-Number of a Part. The ERP-Number column shall be colored according to two other properties that give information about the state of the erp transfer. But I don´t want to display the two additional properties in the main grid. That´s why the two properties are hidden by default. This now leads to the following problem. When my two state properties are hidden, they are not part of the get query that is run when performing a simple search in the Part grid. When the properties are not selected in with the get query, I cannot use them for coloring with my onAfterGet method. Is it somehow possible to add the two properties to the grid select query, but without showing the properties in the grid? Or does anybody now other ways to add some color to grid cells? I am thinking about some federation approach, but maybe this one can be solved easier. Thanks for any help! Best regards, AngelaSolved11KViews0likes6Commentsusing the SQL item type as a view
Querying a SQL view I built in SSMS from an Aras server method: string SQL_View = "innovator.my_custom_sql_view"; string SQL = "select * from " + SQL_View; Item SQL_qry = inn.applySQL(SQL); This is quick for me because I do a lot in SQL, but I know it is bad practice. So, I want to replace this SQL injection using IOM: I created a new SQL item, type=View, with the contents from the custom SSMS view. What is the correct C# code to get the view results? Item SQL_qry = inn.newItem("SQL", "get"); SQL_qry.setProperty("keyed_name", SQL_View); SQL_qry = SQL_qry.apply(); This code just gets the SQL item, not the contents of the View. I couldn't find anything in the Programmers guide for this, and the Blog posts were only about Stored Procedures, not Views. I'm thinking it should work the same way, but I haven't figured out the correct IOM syntax. Thanks, Paul SheehySolved7.8KViews0likes4CommentsUser notification from server methods
Hi, I'm creating server method and populating a new Part structure (+ doing other thing in an method). And last thing from method I would like to send 'on screen ' summary/notification what happened to the user (like inn.newError("Hi, this is what happened")). But as an 'Info' not an _error_. Is there a nice way to send information from server methods to users? //Jukka7.4KViews0likes3CommentsHow to debug server side code in ARAS?
I have added the breakpoint if (System.Diagnostics.Debugger.Launch()) System.Diagnostics.Debugger.Break(); It hits on the method breakpoint in Visual Studio, but I can't see the code nor I can step into it either. Also attaching the error occured for reference. Symbol data not founded for the module. <operating_parameter key="ServerMethodTempDir" value="[path]" /> what path should I enter here?6.7KViews0likes2CommentsAdding Relationships - Server Method
Asking with a more general title, but I'm stuck. I have a need to use a server-side method to generate relationships. Eventually I see this as an admin tool using endpoints whenever I figure out how to pass in a list of names to a method... localhost/.../server/odata/method._Add_Identities Anyway, I run this as-is and it isn't actually adding the identities. Rather than returning the counts I can return one of the identities and see that there is what seems like a new relationship added, but it is not (new to C# -I need to learn how to return multiple items in an array in C# and Innovator) but my ask is: Why isn't the Relationship added here? NOTE: I only added the "isTemp:0" because in the resultant AML, without that, it seems to be set to true. I thought that was the problem... string[] addToIdentities = { "All Employees", "Some Employees", "Solicitors" }; string[] memberIdentityName = { "test user", "foo bar" }; for (int h = 0; h < memberIdentityName.Length; h++) { // The identity that will become the new Member. Item newMember = this.newItem("Identity", "get"); newMember.setProperty("name", memberIdentityName ); newMember = newMember.apply(); for (int i = 0; i < addToIdentities.Length; i++) { // The identity to add Member Relationship to. Item identity = this.newItem("Identity", "edit"); string where = "name = '" + addToIdentities + "'"; identity.setAttribute("where", where); identity = identity.apply(); // Create Member relationship with “related_id”. Item relationship = identity.createRelationship("Member", "add"); relationship.setProperty("related_id", newMember.getID()); relationship.setAttribute("isTemp", "0"); relationship.apply(); } } // Innovator inn = this.getInnovator(); return inn.newResult(memberIdentityName.Length.ToString() + " Identities added as Members to " + addToIdentities.Length.ToString() + " Identites");Solved6.1KViews0likes2Commentsget property list from item type, issue reading the result item
hello, i want to get a list of names of propreties that start a certain way 'z%'. i've found aml that was supposed to do it, i' made an iom code to recrate that aml (actually creates the right aml). But what i get is only one item, so i want to know if the aml is actually good or if there is a specific way to get the properties from that one item i get. [embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:8336f2cd-196d-4ebb-8979-eeead87b54f9:type=text&text=%3CAML%3E%0D%0A%3CItem%20action%3D%22get%22%20type%3D%22itemType%22%20select%3D%22name%22%20where%3D%22ItemType.name%20%3D%20%27ZFCcontrainteTemplate%27%22%3E%0D%0A%09%3Cname%3Epart%3C%2Fname%3E%0D%0A%09%3CRelationships%3E%0D%0A%09%09%3CItem%20type%3D%22property%22%20action%3D%22get%22%20select%3D%22value%2C%20label%22%20where%3D%22%5Bproperty%5D.label%20like%20%27z%25%27%22%20%2F%3E%0D%0A%09%3C%2FRelationships%3E%0D%0A%3C%2FItem%3E%0D%0A%3C%2FAML%3E] [embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:d50be430-1135-40a5-be6a-46672b9d79f9:type=text&text=var%20FCitemType%20%3D%20inn.newItem%28%22itemType%22%2C%20%22get%22%29%3B%0D%0A%2F%2F%20FCitemType.setProperty%28%22name%22%2C%22FCcontrainteTemplate%22%29%3B%0D%0A%2F%2F%20FCitemType.setAttribute%28%22select%22%2C%20%22name%22%29%3B%0D%0AFCitemType.setAttribute%28%22where%22%2C%20%22%5BitemType%5D.name%20like%20%27ZFCcontrainteTemplate%27%22%29%3B%0D%0A%0D%0A%0D%0Avar%20property%20%3D%20FCitemType.createRelationship%28%22property%22%2C%20%22get%22%29%3B%0D%0Aproperty.setAttribute%28%22select%22%2C%20%22label%22%29%3B%0D%0Aproperty.setAttribute%28%22where%22%2C%20%22%5Bproperty%5D.label%20like%20%27z%25%27%22%29%3B%0D%0A%0D%0Aconsole.log%28%22FCitemType%20before%20apply%3A%20%22%2BFCitemType.ToString%28%29%29%3B%0D%0AFCitemType%20%3D%20FCitemType.apply%28%29%3B] thanks lucasSolved5.9KViews0likes7CommentsMethod for event OnAfterUnlock
I want to promote an Item state when user unlock it. I create a simple LifeCycle: "New"-->"Released" I habe write this method on the server event "OnAfterUnlock": Innovator inn=this.getInnovator(); string itemnumber = this.getProperty("item_number"); string state=this.getProperty("state",""); if ( state != "Released" ){ CCO.Utilities.WriteDebug("IP_ScadDocsPromote","Item = "+itemnumber +" State = " + state); this.promote("Released",""); } return this; But it doesn't work. The log IP_ScadDocsPromote show me that the variables "itemnumber" and "state" are blank. Thanks for your help.Solved5.7KViews0likes3CommentsGet beforeupdate Relationships value from parent item
there is a item name -Part and it has relation -Part_relation there are a date field and name field in Part_relation when user update , I want to check the field'value Cannot be earlier than Today When encountering an error, I will return inn.newError(name + date+" error") it is my question When encountering multiple errors, how can I get Part_relation 's information (on the view) show on Error message in Part's beforeUpdate event? I think "this.getRelationships();" works, but I failed after testing. ---------------------------------------------------- string log =""; Innovator inn = this.getInnovator(); Item rootitem = inn.getItemById(this.getType(), this.getID()); //on the view's all relationship Item thisrela = this.getRelationships(); string today = DateTime.Now.ToString("yyyy/MM/dd"); DateTime nowdate = Convert.ToDateTime(today); for(int a=0 ; a<thisrela.getItemCount(); a++){ Item tR = thisrela.getItemByIndex(a);----> it can't run //on view's date string updateday = Convert.ToDateTime(tR.getProperty("ts_complete_date")).ToString("yyyy/MM/dd"); DateTime update = Convert.ToDateTime(updateday); if(DateTime.Compare(nowdate,update)>0){ log += "tR.getProperty("name")+update+" Error."; } } if(log!=""){ return inn.newError(log); }5.4KViews0likes2Comments