Save Custom Form Data on CUI Save Button Click

How do we extend the CUI save button click event. I need to save data in a relationship custom form. I tried using the below function
aras.registerEventHandler('ItemSave', window, saveFunction);
However, the "saveFunction" is triggered even after i move out of the window to other forms.
Parents
  • Okay, I don´t understand your usecase. But I will throw in a code for a custom save button with CUI. This one takes the id from the grid an than triggers the "Save" manually.
    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("save");
        item.setAttribute("doGetItem", "0");
        item = item.apply();
        if (item.isError()) 
        {
    	    return aras.AlertError(item.getErrorString());
        }
        main.work.searchContainer.runSearch();
    }
    
    return item;
    If you need something else, you have to provide more information to your use case :-)
Reply
  • Okay, I don´t understand your usecase. But I will throw in a code for a custom save button with CUI. This one takes the id from the grid an than triggers the "Save" manually.
    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("save");
        item.setAttribute("doGetItem", "0");
        item = item.apply();
        if (item.isError()) 
        {
    	    return aras.AlertError(item.getErrorString());
        }
        main.work.searchContainer.runSearch();
    }
    
    return item;
    If you need something else, you have to provide more information to your use case :-)
Children
No Data