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

Parents
  • 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

  • 0 オフライン in reply to Gopikrishnan

    thanks a lot for your fast response, i've updated the method with the code you gave me and i get this error:

    Details in 6 temporary files C:\Program Files (x86)\Aras\Innovator\Innovator\Server\dll\nlor1c1u Line number 19, Error Number: CS1012, Too many characters in character literal Line number 19, Error Number: CS1026, ) expected Line number 19, Error Number: CS1513, } expected Line number 22, Error Number: CS1513, } expected

  • 0 オフライン in reply to lucas

    I believe the method you modified is C# method. Current OOTB instance, Create New Revision use Server Side Code. Unfortunately, we can give warning / confirmation only through client side method. So, my solution would be

    1. Change the Action to Client Side 

    or 

    2. Create New Client Side action and attach the above code as new Javascript Method

Reply Children