Skip to content

Instantly share code, notes, and snippets.

View cgillis-aras's full-sized avatar

Chris Gillis cgillis-aras

View GitHub Profile
<!-- Use this query to get all documents with no file attached -->
<AML>
<Item type="Document" action="get" select="item_number">
<has_files>0</has_files>
</Item>
</AML>
<!-- Use this query to get all documents with a file, but not a PDF -->
<AML>
<Item type="Document" action="get" select="item_number">
function doubleClickHandler(result, type_of_action) {
if (type_of_action == "doubleclick") {
// Do something with the result. In this example, we'll just print out the ID
if (result.item) {
var type = 'Part';
var itmID = result.item.getAttribute("id");
alert("Got " + type + " with ID: " + itmID );
}
return false; // Return false, so the dialog doesn't close
} else {
var Filter = {};
/*
* This filter will apply to the "state" column
* filterValue: The value to be pre-loaded when the search dialog is opened
* isFilterFixed: Whether the user can change this value after the dialog is opened
*/
Filter["state"] = { filterValue: "Released", isFilterFixed: true };
return Filter;
Innovator inn=this.getInnovator();
// *** Express ECO ********************************************************* //
Item hd= inn.newItem("Express ECO","get");
hd.setID(this.getID());
hd.setAttribute("select","item_number,title,eco_type,team_id");
hd = hd.apply();
// *** Email From ********************************************************** //
Item innAdm= inn.newItem("User","get");
innAdm.setAttribute("select","first_name,last_name,email");
<script type="text/javascript">
showRelatedItems = function() {
var part = document.thisItem;
var relationships = aras.getRelationships(part.node, "Part BOM");
var container = document.getElementById("relatedItemContainer");
for (var i = 0; i < relationships.length; i++)
{
var relItem = aras.getRelatedItem(relationships[i]);
Innovator inn = this.getInnovator();
// Get all generations of all Parts
Item parts = inn.newItem("Part", "get");
parts.setProperty("generation", "0");
parts.setPropertyAttribute("generation", "condition", "gt");
parts.setAttribute("select", "id");
parts = parts.apply();
// Create a list of all of the IDs of all Parts
/*
This code is adapted from the hide tabs code at the gist below.
https://gist.github.com/EliJDonahue/521dea1dc20a069c13ba356f4142283f#file-aras_labs_hide_tabs-js
The intention of this code is to check if a relationship grid is loaded in an OnLoad event.
*/
var tabbar;
var desiredTabId;
var vlt = top.aras.vault;
var srcId = this.getID();
var parentItm = this.node;
vlt.selectFile().then(function (fileObject) {
var d = aras.IomInnovator.newItem("Document File", "add");
d.setProperty("source_id", srcId);
d.setFileProperty("related_id", fileObject);
d.apply();
top.aras.uiReShowItemEx(srcId, parentItm); // Refresh the window, so the new relationship is shown
});
/*
* This will be called from a custom CUI shortcut when the user presses CTRL+A.
* It will select all of the items in the grid from the Main Window
*/
// Get all selected items, so we don't unselect them
var workFrame = this.work;
var selectedIds = workFrame.grid.getSelectedItemIds(',').split(',');
var rowNum = workFram.grid.getRowCount();
Innovator inn = this.getInnovator();
// We only want this to run for Innovator Admin, so we're passing in the ID of the admin User
string aml = "<AML>" +
"<Item type=\"Part\" action=\"unlock\" where=\"[part].locked_by_id = '30B991F927274FA3829655F50C99472E'\">" +
"</Item>" +
"</AML>";
Item res = inn.applyAML(aml);
return this;