Skip to content

Javascript How To

Eric Domke edited this page Jul 12, 2019 · 6 revisions

Show an item in a new tab

top.aras.uiShowItem(itemTypeName : String, itemID : String, viewMode? : String, isUnfocused? : Boolean);
  • itemTypeName: may be empty string if item is in client cache
  • itemID: ID of the item obligatory
  • viewMode: 'tab view' or 'openFile', if not specified aras.getVariable('viewMode') is used
  • isUnfocused: true or false, if not specified aras.getVariable('TearOff') is used

Run a report

top.aras.runReport(report : Element, itemTypeID : String, item : Element);
  • report: Report element
  • itemTypeID : ID of the itemtype. Can be an empty string and inferred from the item parameter
  • item: AML definition of the item
var report = top.aras.getItemByKeyedName("Report", "{Report Name}");
var item;   // XML Node representing item. Could be result of 
            // top.aras.getItemById('{ItemType}', '{Item ID}')
top.aras.runReport(report, "", item);

Call a client method

top.aras.evalMethod(methodName : String, itemNode : Element, addArgs? : Object);
  • methodName: the name of the Method item
  • itemNode: the item dom
  • addArgs: Object with any additional parameters.

Perform an item copy (Save As)

top.aras.copyItem(itemTypeName : String, itemID : String);

Lock item

top.aras.lockItem(itemID : String, itemTypeName : String);

Show Properties Window

top.ArasCore.Dialogs.properties(item : Element, itemType : Element, options? : Object)
  • item: Item node
  • itemType: ItemType node
  • options: options object. For example, {aras: this.aras}

OR

top.aras.getMainWindow().ArasCore.Dialogs.properties(...)

Show revisions windows

This should be executed from Javascript on a form

window.parent.onRevisionsCommand()

Collapse relationships from form

v12+

parent.document.querySelector('.aras-item-view__relationship-accordion').collapse()

< v12

parent.windowStateObject.setCollapse();
parent.windowStateObject.updateButtons();

Event Handlers

top.aras.registerEventHandler(event : String, window : Any, callback : Any);

Events:

  • VariableChanged
  • PreferenceValueChanged
  • ItemLock
  • ItemSave

Open a TOC Item

v12+

aras.getMainWindow().arasTabs.openForm(formId, icon, label)
aras.getMainWindow().arasTabs.openPage(url, itemTypeId, icon, label)
aras.getMainWindow().arasTabs.openSearch(itemTypeId, [savedSearchID])

< v12

top.tree.onGridClick("InBasket Task")
top.tree.mainTreeApplet.select("InBasket Task")
Clone this wiki locally