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

  • Hi

    Steps to be followed are:

    Step 1: Navigate to Actions --> Search for PE_CreateNewRevision

    Step 2: Change the Location to Client

    Step 3: Create a New JavaScript Method and copy above code

    Step 4: Add this method in PE_CreateNewRevision action

    Test and let me know if it works.

  • 0 オフライン in reply to Gopikrishnan

    my method and action are actually both client side

  • 0 オフライン in reply to Gopikrishnan

    hello

    I followed the step you gave me but still get the same error message:

    Details in 6 temporary files C:\Program Files (x86)\Aras\Innovator\Innovator\Server\dll\veqio3ej 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
    OKMasquer les détailsCopier dans le presse-papier
  • 0 オフライン in reply to lucas

    Have you modified this method PE_CreateNewRevision ? 

    Changed from Server Side to Client Side ?

Reply Children