Skip to content

Instantly share code, notes, and snippets.

View YoannArasLab's full-sized avatar

Yoann Maingon YoannArasLab

View GitHub Profile
// retrieve the document name
String documentName = this.getProperty("name");
// retrieve the document id
String documentID = this.getID();
// create the POST web request
var httpWebRequest = (HttpWebRequest) WebRequest.Create("https://hooks.slack.com/services/XXXXX/XXXXX/XXXXXXXXXX");
httpWebRequest.ContentType = "text/json";
httpWebRequest.Method = "POST";
@YoannArasLab
YoannArasLab / GetControlledItem.cs
Created November 3, 2016 20:48
(Aras PLM Server Side Method ) Get Controlled Item when called within a method triggered from a Workflow
// Retrieve the workflow item(s)
Innovator inn = this.getInnovator();
Item wflItem = this.newItem("Workflow","get");
wflItem.setAttribute("select","source_id,source_type");
Item wflProc = wflItem.createRelatedItem("Workflow Process","get");
wflProc.setAttribute("select","name");
Item wflProcAct = wflProc.createRelationship("Workflow Process Activity","get");
wflProcAct.setAttribute("select","related_id");
wflProcAct.setProperty("related_id",this.getID());
<!--
Copyright (c) 2016 - Aras Corp
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:
@YoannArasLab
YoannArasLab / index.html
Created March 21, 2017 14:21
Custom Aras Innovator page to show a graph representation of a Bill of Materials
<!DOCTYPE html>
<head>
<style>
body {
width: 100%;
height: 100%;
}
#graph {
var returndata = {
"value":document.getElementById("MainDataForm").availableitems.value,
"label":document.getElementById("MainDataForm").availableitems.label
}
window.parent.dialogArguments.dialog.close(returndata);
var partDefId = document.thisItem.getPropertyItem("definition");
partDefId.fetchRelationships("Part AML");
var select = document.getElementById("MainDataForm").availableitems;
for (var i = 0; i< partDefId.getRelationships("Part AML").getItemCount();i++){
var value = partDefId.getRelationships("Part AML").getItemByIndex(i).getRelatedItem();
select.options[i]=new Option(value.getProperty("name"), value.getProperty("id"));
}
return true;
var formName = "purchaseItem";
var itemtype = this.getAttribute("type");
var inn = this.getInnovator();
var keyedname = this.getProperty("keyed_name");
var instancedPart = this;
var title = itemtype + " " + keyedname
var win = aras.getMostTopWindowWithAras(window);
var formNd = aras.getItemByName('Form', formName);
var inn = this.getInnovator();
var myBom = inn.newItem("Part","GetItemRepeatConfig");
myBom.setAttribute("select","item_number,name");
myBom.setID(this.getID());
// test ID
//myBom.setID("E66A03962B24404B8F7EA7494B98A406");
var partBom = myBom.createRelationship("Part BOM");
partBom.setAttribute("select","related_id,quantity");
partBom.setAttribute("repeatProp","related_id");
partBom.setAttribute("repeatTimes","10");
// to be set on after get
// setup (should be moved to variables)
string username= "user";
string password="mypassword1234";
// build search string
string ids="(";
for (int i=0;i<this.getItemCount();i++){
if (i!=0){
string username = "myuser";
string password = "mypassword";
string encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username+":"+password));
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://myJiraServer/jira/rest/api/2/issue/");
request.ContentType="application/json";
request.Method="POST";
request.Headers.Add("Authorization","Basic "+encoded);
using(var streamWriter = new StreamWriter(request.GetRequestStream())){