save , unlock and close

オフライン
Hi how can i save changes by save , unlock and close button ? regards .
  • Hi I make it but with button with event on click with this code : var innovator = new Innovator(); var partItem = innovator.newItem("result4","get"); var t4id = document.thisItem.getProperty("t4id"); var t4date = document.thisItem.getProperty("t4date"); var t4name = document.thisItem.getProperty("t4name"); var t4comment = document.thisItem.getProperty("t4comment"); console.log(t4id); console.log(t4date); console.log(t4name); console.log(t4comment); getFieldByName("text0").getElementsByTagName("input")[0].value=t4id; getFieldByName("text1").getElementsByTagName("input")[0].value=t4date; getFieldByName("text2").getElementsByTagName("input")[0].value=t4name; getFieldByName("text3").getElementsByTagName("input")[0].value=t4comment; var t5button = getFieldByName("Update"); var lockstatus=document.thisItem.fetchLockStatus(); if (lockstatus===0) { console.log("the item is locked"); t5button.getElementsByTagName("input")[0].disabled = true; } else t5button.getElementsByTagName("input")[0].disabled = false; but i want make the changes with out button , i want with save , unlock and close button ?  
  • Maybe this one works: parent.onSaveUnlockAndExitCommand(); oronSaveUnlockAndExitCommand(); The File formtool_window.js in the codetree gives a good overview of these Form functions.
  • Thank you for your answer . where should I write this command? i mean which event ?
  • It depends on your usecase. E.g. you have some "Do something" button in your Item-Form that triggers an "onClick" Javascript Method. Than you can add this code at the end of the Method.
  • Hi thank you for your answer . I added this command , but the changes not saved , the code is : var inn = aras.IomInnovator; var t5id = getFieldByName("text0").getElementsByTagName("input")[0].value; var t5date = getFieldByName("text1").getElementsByTagName("input")[0].value; var t5name = getFieldByName("text2").getElementsByTagName("input")[0].value; var t5comment = getFieldByName("text3").getElementsByTagName("input")[0].value; var t5button = getFieldByName("Update").getElementsByTagName("input")[0].value; var innovator = new Innovator(); var partItem = innovator.newItem("result4","edit"); var id = document.thisItem.getProperty("id"); partItem.setID(id); partItem.setProperty("t4id", t5id); partItem.setProperty("t4date", t5date); partItem.setProperty("t4name", t5name); partItem.setProperty("t4comment", t5comment); partItem.apply(); partItem.lockItem(); console.log(id); parent.onSaveUnlockAndExitCommand();
  • How many ItemTypes are involved in this usecase? parent.onSaveUnlockAndExitCommand() will only save your current context Item, not your Result4 Item. As far as I understand your code you want to change a "Result4" Item from in the Form of another ItemType. Is this correct? Why do you want to lock and unlock your Item after partItem.apply()?
  • Hi it was false , i want to save the new value with save and unlock and exit button .