var parentItem = parent.thisItem; if (parentItem.fetchLockStatus() == "1") { // get form context var instanceFrame = parent.parent.document.getElementById("instance"); if (instanceFrame && instanceFrame.contentWindow) { instanceFrame = instanceFrame.contentWindow; alert("alert"); } // update the parent property in cache if (instanceFrame.handleItemChange) { instanceFrame.handleItemChange("description","test"); } } else { alert("Parent is not locked, or is locked by another user."); }Note that this updates the item in cache, not the server. If the user wants to save the changes to the server, they'll need to click "Save". If you want to automatically save the changes to the parent and refresh the form, you can do something like this:
var parentItem = parent.thisItem; if (parentItem.fetchLockStatus() == "1") { parentItem.setProperty("description","test1"); parentItem.setAction("edit"); parentItem = parentItem.apply(); aras.uiReShowItemEx(parentItem.getID(), parentItem.node); } else if (parentItem.fetchLockStatus() == "0") { // lock and update the parent or warn user alert("Parent is not locked. Please lock."); } else { alert("Parent is locked by another user or cannot be locked."); }Eli
var parentItem = parent.thisItem; if (parentItem.fetchLockStatus() == "1") { // get form context var instanceFrame = parent.parent.document.getElementById("instance"); if (instanceFrame && instanceFrame.contentWindow) { instanceFrame = instanceFrame.contentWindow; alert("alert"); } // update the parent property in cache if (instanceFrame.handleItemChange) { instanceFrame.handleItemChange("description","test"); } } else { alert("Parent is not locked, or is locked by another user."); }Note that this updates the item in cache, not the server. If the user wants to save the changes to the server, they'll need to click "Save". If you want to automatically save the changes to the parent and refresh the form, you can do something like this:
var parentItem = parent.thisItem; if (parentItem.fetchLockStatus() == "1") { parentItem.setProperty("description","test1"); parentItem.setAction("edit"); parentItem = parentItem.apply(); aras.uiReShowItemEx(parentItem.getID(), parentItem.node); } else if (parentItem.fetchLockStatus() == "0") { // lock and update the parent or warn user alert("Parent is not locked. Please lock."); } else { alert("Parent is locked by another user or cannot be locked."); }Eli
Hi Eli,
We have similar situation where relationship grid js code update parent data and apply them. The code above works perfectly however our parent is versionable and on edit new generation of parent item is made.
So when we use code:
aras.uiReShowItemEx(parentItem.getID(), parentItem.node);
old tab with old generation is still open plus new tab is created with new generation.
Is any way to avoid this and just refresh parent form?