Modify Revision History (revisionDialog.html) for specific ItemTypes

Hi, I need some help in building a custom Revision History for the ItemTypes "Part" and "Document". The standard revision history will display a set of standard properties (e.g. generation) and all non-hidden properties. We use a lot of hidden=0 properties in the ItemTypes Part and Document. Most of them are useful in the search grid but not of interest in the revision history. I want to disable most of these properties and add an additional property verion_comment instead. This property contains short information about the revision specific changes and is e.g. triggered by the Office connector. The revision history is created by the following codetree file: ../Client/scripts/revisionDialog.html The file contains an xpath query that defines what should be shown in the revision history. I plan to use a custom xpath string based on the ItemType.
// default xpath
var xpath = "Relationships/Item[@type=\"Property\" and (not(is_hidden) or is_hidden=0 or name=\"generation\" or name=\"major_rev\" or name=\"comments\")]|Relationships/Item[@type=\"xItemTypeAllowedProperty\"]/related_id/Item";

// custom code - overwrite xpath for specific ItemTypes
if (itemTypeName == "Part"){
xpath = "Relationships/Item[@type=\"Property\" and (name=\"generation\" or name=\"major_rev\" or name=\"comments\" or name=\"item_number\" or name=\"name\" or name=\"id\" or name=\"version_comment\")]|Relationships/Item[@type=\"xItemTypeAllowedProperty\"]/related_id/Item";
}
The basic idea works fine! My custom xpath is successfully used when open a Part revision history. Also adding the additional version_comment property works. But I cannot get rid of the non-hidden properties. Deleting the code used for the hidden properties crashes the revision history and I will not get no results any more (=empty table without columns). Any idea what could be missing in my xpath? Are there some required properties that I have to add? Using a TGV view for a custom revision history would work but is not an option right now. In SP11 the TGV view is slower than the standard revision history. The current TGV version also cannot use a custom orderBy property and will only sort accross the sort_order property (if there is one). But a revision history shall use the generation property for sorting. Thanks for any input! Angela
  • Hi Angela, the following code works in my test-system:
    var xpath = "Relationships/Item[@type=\"Property\" and (not(is_hidden) or is_hidden=0 or name=\"generation\" or name=\"major_rev\" or name=\"comments\")]|Relationships/Item[@type=\"xItemTypeAllowedProperty\"]/related_id/Item";
    			
    // custom code - overwrite xpath for specific ItemTypes
    if (itemTypeName == "Part")
    {
    	xpath = "Relationships/Item[@type=\"Property\" and (name=\"generation\" or name=\"major_rev\" or name=\"item_number\" or name=\"name\" or name=\"id\" or name=\"version_comment\")]|Relationships/Item[@type=\"xItemTypeAllowedProperty\"]/related_id/Item";
    }
    The result is: for itemtype 'Part' only the properties generation, major_rev, item_number, name, id and version_comment are used in the revision history.
  • Hi Andreas, thanks for testing! Which Aras version did you use? Did you do anything else despite deleting the browser cache to trigger the codetree change? I currently use SP11, but just could not get this one running. My customized revision history will only contain one grey box, propably the table header for the lock column. But no additional columns and no rows are displayed. when I debug the code, the property visiblePropNds contains my filtered properties. So the xpath definitely works. All item ids are returned and the grid_xml will contain the complete html code for rendering the table, based on the filter. I somehow assume it´s related to the xProperties (which I don´t use yet).
  • Hi Angela, I tested this in an SP11 instance, and I can confirm that the grid didn't load as expected. Looking at the revisionDialog.html, I believe this is an issue with the Grid trying to pull the columns to display from the cache. I was able to see the grid by making the change below to the initGrid() function of the revisionsDialog.
    function initGrid() {
    var colWidths = topWnd.aras.getPreferenceItemProperty('Core_ItemGridLayout', itemTypeID, "col_widths");
    var colOrder = topWnd.aras.getPreferenceItemProperty('Core_ItemGridLayout', itemTypeID, "col_order");
    if (itemTypeName == "Part")
    {
    colOrder = "L"; // Add a default column of the Lock state
    colWidths = "24";
    }
    Chris
    Christopher Gillis Aras Labs Software Engineer
  • One more thing. If you haven't already, I'd recommend making a copy of the revisionDialog.html that doesn't contain any code changes called something like revisionDialog_default.html. This way you can restore to a clean version if the changes made cause unintended behavior. Chris
    Christopher Gillis Aras Labs Software Engineer
  • Hi Chris, thank you for testing this in your system! I wouldn´t been able to fix this one. With your additional code, the revision history now works as expected. I agree that changes to the codetree files without backup of the native file wouldn´t be very smart. But to share a few of my own experiences: I would also recommend to everybody to write down modifications of this kind into a separate document. Reason is very simple -> Update! Especially small code tree changes have a high risk of getting lost during update. Angela
  • Hi Angela, just for your information: I tested with SP12. Andreas