Skip to content

Instantly share code, notes, and snippets.

View AngelaIp's full-sized avatar
👑
There are many PLM experts, but there is only one Queen!

AngelaIp

👑
There are many PLM experts, but there is only one Queen!
View GitHub Profile
@AngelaIp
AngelaIp / DisableDateField.js
Created May 4, 2023 16:44 — forked from cgillis-aras/DisableDateField.js
Sample code demonstrating how to disable a date field in Aras Innovator
var input = getFieldByName("effective_date");
input.getElementsByTagName("input")[0].disabled = true;
input.getElementsByTagName("input")[1].disabled = true;
input.getElementsByTagName("input")[1].src = "../images/calendar-disabled.svg";
@AngelaIp
AngelaIp / AttributeShorthandFunctions.cs
Created May 4, 2023 16:43 — forked from cgillis-aras/AttributeShorthandFunctions.cs
Examples of the specific attribute shorthand functions in Aras Innovator.
Innovator inn = this.getInnovator();
Item part = inn.newItem();
/* All of the pairs of functions below are equivalent */
// Set the type attribute
part.setAttribute("type", "Part");
part.setType("Part");
// Set the action attribute
part.setAttribute("action", "get");
@AngelaIp
AngelaIp / notify.js
Created May 25, 2020 16:14
Show neutral notification in Innovator
const notify = aras.getNotifyByContext(window);
notify("Blue notification message is displayed");
@AngelaIp
AngelaIp / OpenItemInEditMode.js
Created September 10, 2019 16:28 — forked from cgillis-aras/OpenItemInEditMode.js
Sample JavaScript code to open an item in edit mode in Aras Innovator 12.0
/*
* We need to wait for the item's form to fully load before we switch the window to edit mode.
* Luckily, aras.uiShowItem returns a Promise that happens to resolve once the window loads. This
* means we can pass in a function using Promise.then(ourFunction) that will be called after the
* Promise resolves and the item window is loaded.
*/
aras.uiShowItem("Part", "64B2100E21B44980B42FB445951310BF").then(function()
{
// Look up the tab that was just loaded
var myItemWin = aras.uiFindWindowEx("64B2100E21B44980B42FB445951310BF");
@AngelaIp
AngelaIp / LICENSE
Created June 24, 2019 15:12
This license applies to all public gists https://github.com/AngelaIp
MIT License
Copyright (c) 2019 AngelaIp
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@AngelaIp
AngelaIp / UG_resetProperties_onAfterCopy
Created June 24, 2019 06:54
Resets specific properties after copying a part
Innovator inn = this.getInnovator();
string id = this.getProperty("id");
// Check if Goal relationships are available;
Item goals = this.newItem("Part Goal","get");
goals.setProperty("source_id",id);
goals.setAttribute("select", "id");
goals = goals.apply();
@AngelaIp
AngelaIp / callServerFromServer.cs
Created March 15, 2019 07:36
Call Server Method from Server Method
Innovator inn = this.getInnovator();
this.setProperty("myproperty_","valueofsomething");
Item res = this.apply("MyTestMethod");
if (res.isError())
{
XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(res.ToString());
string faultstring = xDoc.SelectSingleNode("//faultstring").InnerText;
return inn.newError("Error while doing something: " + faultstring);
}
@AngelaIp
AngelaIp / downloadFile.js
Created March 14, 2019 15:49
Download file to local host in Arsa
// Download file to local host
var check = aras.downloadFile(fileItem, newFileName);
if (check === true)
{
aras.AlertSuccess("Download successful");
}
else
{
aras.AlertSuccess("Download failed");
}
@AngelaIp
AngelaIp / readActionBody.js
Created July 18, 2018 07:06
Passing parameters from 'ItemType' Action body to Client Methods
/* Example body used in Action with Type 'ItemType'
<body>
<formId>1234570871854123453362C7B712345</formId>
<formTitle>My Example Form</formTitle>
</body>*/
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(this,"text/xml");
var formId = xmlDoc.getElementsByTagName("formId")[0].childNodes[0].nodeValue;
var formTitle = xmlDoc.getElementsByTagName("formTitle")[0].childNodes[0].nodeValue;