apply PE_createNewRevision from client method
hello,
My initial goal is to have a confirm pop up when using the action to create a new revision.(for parts)
I have an action that run a simple client method like this:
if(confirm("creation of new major revision"))
{
//here i want to launch the PE_CreateNewRevision
}
I've tried with applyMethod but the method doesn't seem to apply on the part instance. Any help on understanding this is much appreciated.
thanks
lucas
Hi Lucas
Can you update your client side method with below code
var wnd = aras.getMainWindow();
var topWnd = aras.getMostTopWindowWithAras(window);
wnd = wnd === topWnd ? wnd.main : topWnd;
var selectedId;
var itemTypeName;
var innovator = new Innovator();
if (wnd.parent.main) {
itemTypeName = wnd.parent.main.work.itemTypeName;
selectedId = wnd.parent.main.work.grid.getSelectedItemIds();
} else {
itemTypeName = wnd.itemTypeName;
selectedId = [wnd.itemID];
}
if (selectedId.length < 1) {
return;
}
var contextItem = innovator.newItem(itemTypeName, "get");
contextItem.setAttribute("id", selectedId);
contextItem = contextItem.apply();
if (!contextItem.isError()) {
var confirmation;
confirmation = aras.confirm("creation of new major revision ?");
if (confirmation !== true) {
return false;
} else {
contextItem.setAction('PE_CreateNewRevision');
var result = contextItem.apply();
if (result.isError()) {
return top.aras.AlertError(result.getErrorString());
}
}
}Let me know if it works.
Thank You
Gopikrishnan R