How to create a new Part TOC menu item that does a custom search?

Hi, On the ACE 2017 Europe conference, a technique that utilized Federated Data to add a TOC menu item that did a custom search was showcased. In my case, I want to add a new TOC menu item, besides the Part menu item, that searches among Released Parts. I.e., the menu item should be called "Parts Released", clicking it and then clicking the "Run Search" button should return a list of parts that are released. On the conference, they said that I should create a new dummy ItemType, and redirect its requests to the real Part by modifying the onBeforeGet to server event. Apparently this is related to data federation according to the presenter. However, I do not remember the exact steps to implement this. I got the impression that there should example code demonstrating this on Aras' GitHub page. However, I have browsed through several pages of Aras' repositories on GitHub, and I cannot find any project that sounds to be what I am looking or. Does anybody know how to achieve what I am asking for? Or where sample code can be found? Please tell me if you want me to clarify anything in my description. Thanks,
  • Amazing work, Angela. I haven't really worked with CUI buttons before, only looked at it briefly once. If I understand your project correctly, essentially you are replacing the buttons with your own (directories "CommandBarItem", "CommandBarSection", "CommandBarSectionItem" and "PresentationConfiguration") that call your own methods (directory "Method")? I guess the key is inn.getItemById("Part", id);, when it uses the custom Part it seems like the caching gets screwed up or something. Does your project overwrite the existing buttons? Or are they only added for the custom part?
  • I emailed the developer who did the presentation, and he answered that he implemented it in the following way:
    here are the steps to do it :
    • ​Create an ItemType "Component"
    • Add properties that you want to use (same as origin ItemType) : item_number, name....
    • Add an entry on the TOC
    • Add this method on the server event "OnGet" :
      • ---- ​this.setAttribute("type", "Part"); this.setProperty(" classification", "Component"); return this.apply(); ---
    • ​​That's all !
    However, that's what we started with. So I asked about our issues with Lock, Unlock, Structure browser, etc. His reply was:
    Yes most of the features to work correctly on an item requires the item to be opened in order to leave this “fake” item context.
    So I guess what you have accomplished is the best solution to the problem (I haven't tried it yet myself though).
  • Hi KalleAnka, by default each ItemType shares a basic set of default GUI elements. With a custom Presentation Configuration you can add/replace/delete GUI elements. My current sample doesn´t overwrite the default configuration. Every other ItemType will still use the standard stuff. The changes are unique for the Fake-Part-ItemType. The main work is done in the Methods. We need two different types: - Click Methods -> they do the job . By default the Methods link to their original ItemType. Normally that's good. But in our case that's exactly the wrong behavior. My Methods read the Part ID from the grid and use it for operations with the original Part. The Methods shall never sees the Fake-ItemType. - Init Methods -> they take care for the appearance, e.g. shall the lock button be active or greyed out. I currently use the default reinit methods. This works fine in most cases. In my current version only the Save button still makes some trouble. But it shouldn´t be a big task to fix that. As example: The standard Lock button is CommandBarItem com.aras.innovator.cui_default.mwt_main_toolbar_lock. It use the Init Method cui_reinit_mwt_lock and the Click method cui_default_mwt_onLockCommand. The corresponding CommandBarSectionsItemreplace this lock button with my own. The look&feel stays the same, but the Click Method now references hard to Part. I recommend to delete the browser cache to make the project run properly. I plan to use the project in production in around 2-3 weeks, then I will fix the last few bugs. Maybe I can provide a sample of the full ItemType. There are many small config settings necessary to make it run flawless. Of course, if there is another simpler solution, I would be highly interested in it! I think the whole stuff can also be solved on SQL level (Polyitems do something similar), but my SQL-skills are incompatible with the requirements of such a task. Since Aras use a similar concept in the Inbasket, the solution cannot be that bad.
  • Hi KalleAnka, I uploaded a second draft including the full ItemType to github.com/.../custom-itemtype-view .
  • I have done some basic cleanup of the sample project and added an image for a sample use case. -> github.com/.../custom-itemtype-view Currently, I am having mixed feeling about the current result. I still like the idea and the basic sample works. But the current version is inflexibly and terrible to maintain. Instead of treating each non-working CUI button separately, maybe a better approach is the use of CUI Methods, that handle the parameters passed to the original CUI buttons. I made some successful attempts with the automatic linking of the original Part Actions and Reports to the FakePart with a additional Methods in the Presentation Configuration. This way Actions and Reports were automatically added to the Main Window Menubar and Main Window PopUp Menu. But I still do not have enough programming knowledge to use this concept for all of the related CUI elements. Maybe things will become a little bit easier with the new xProperties, but I haven´t tried yet. I do not work on the project often, but I think I'll find the missing piece of the puzzle someday. All fresh ideas for this project are very welcomed!!!
  • I am happy to see that this forum thread is one of the most viewed in the Aras forum.

    @Hey Aras,

    Can you give me a short update to this one? Will the feature discussed in this threat actually be a standard feature in 12 SP4? I have seen something comparable at ACE Europe in a presentation about upcoming features. I at least know that Aras knows about this topic and the project and that it was used by some folks out there. Even if the project is mainly a proof-of-concept, it would be fair to know, if Aras decided to provide a standard solution for this task. It´s important that these kind of information is available for community, to avoid that the community wastes further time for ideas that already made it to the Aras roadmap.

  • Any news? Lately, getting answers from Aras has become very difficult.

  • Hi, first of all I'd love to thank all the users for your input.
    I am also facing problem of creating "fake" items instead of custom searches - in my case for chosen classes of Documents.

    To give you the picture I have added new Item types reflecting all properties and permissions of Document item type. I added server event (found here :)) to "redirect" to Documents item type and set it "onGet", "onAdd", "onUpdate" also added 1 client event to enable Add new to create new Document (2 line JS also found here)

    For now I am able to lock unlock or save as the "fake" item but first I have to open and close the item, I guess to keep to "original item" in place. When I try without this step, it tries to get the "fake" item type.
    With refreshing the topic I'd like ask if some of you tried to make all the buttons and actions "cloned" from original item type?

    Thanks, Best regards.

  • Hi LukSor,

    please notice that this one is a 3 year old discussion and project made by strangers from the internet :). 

    In Innovator 12 Saved Searches improved so I am not sure if this project is still worth the effort.

    I am not aware of your 'need to open/close behavior'. Maybe you check out the github project that is linked somewhere which contain the lastest code and not just code snippets. 

    It´s possible to manually add Actions or Reports to the fake item, but this is a lot of work when you want to do many of them. I once make a couple of tests to automatically assign the Actions and Reports by CUI Methods, even have somewhere around an old code sample if you really want to take this topic seriously. 

    Angela