onUpdate
for locking to work and onAdd
for Save as
to work.
I believe the KEYED_NAME
, INSTANCE_DATA
columns are just for finding out the table name of an item type, which might be needed if you are going to write SQL instead of AML.lock
and unlock
of existing Parts work fine.
Save As is still optimizable. After Save As
a new copy of the Part is generated, but users have to refresh the grid and the new Item is not shown in a separate window automatically. Most users will high-likely create 5-6 Part copies until they realize that they have to refresh the grid.
Maybe this can be solved with some extra javascript logic.
After Save As
the new Part-copy cannot be unlocked in the grid -> Aras.Server.Core.ItemNotFoundException
Unfortunately there is no onLock Method option that could be used here.Core_ItemGridLayout
that renders the grid, but I might be wrong. Since no form is specified in the Part ItemType's TOC View
relationship, or in our custom Part ItemType for that matter, I assume it automatically falls back on the standard grid. But maybe it's overkill to try to override the default grid.
Perhaps it's possible to add a JS method under the ItemType's Server Events
or Client Events
that gets called whenever the item is saved. I guess you could escape the item's tab by using parent
in JS and then locate the grid iframe which seems to be named work
, i.e. parent.document.getElementById('work')
.var inn = this.getInnovator();
var topWindow = aras.getMostTopWindowWithAras(window);
if (topWindow.work && topWindow.work.grid) {
var workFrame = topWindow.work;
// var selectedIds = workFrame.grid.getSelectedItemIds(',').split(',');
var id = workFrame.grid.getSelectedID();
var item = inn.getItemById("Part", id);
item.setAction("lock");
// item.setAttribute("doGetItem", "1");
item = item.apply();
if (item.isError()) {
return aras.AlertError(item.getErrorString());
}
// todo: Refresh Grid of new ItemType
// parent.onRefresh(); // don´t work
}
Locks the Part without error message. But refreshing the grid of the new ItemType don´t work.var inn = this.getInnovator();
var topWindow = aras.getMostTopWindowWithAras(window);
if (topWindow.work && topWindow.work.grid) {
var workFrame = topWindow.work;
var id = workFrame.grid.getSelectedID();
var item = inn.getItemById("Part", id);
item.setAction("copy");
// item.setAction("lock");
// item.setAction("unlock");
item.setAttribute("doGetItem", "0");
item = item.apply();
if (item.isError()) {
return aras.AlertError(item.getErrorString());
}
main.work.searchContainer.runSearch();
}
return item;
Works without error messages and also the grid is updated. The rest should be just some CUI configuration.