Skip to content

Instantly share code, notes, and snippets.

View NithinMahesh1's full-sized avatar

Nithin Mahesh NithinMahesh1

  • EQengineered
View GitHub Profile
/*
* Inputs:
* -this: Context Item
* -Properties:
* -pullType - PullType: Options are DDRBaseline, UnitNWD, Baseline, InitialBaseline, or InProgress
* -isInternal - Internal method or not (if not necessary, omit all references to isInternal
*/
//This code grabs a Conversion Rule's ID, an Identity to run the Conversion Rule, a series of properties that need to be added, and then creates a Conversion Task based on the data provided
@NithinMahesh1
NithinMahesh1 / eventHandlerDataRetrieval.cs
Created July 26, 2023 14:56
Custom Event Handler Retrieval Method
Item relationships = this.getRelationships();
int eventItemsCount = relationships.getItemCount();
/* for each event in this batch, get the event details and perform
custom publishing logic */
for (int i = 0; i < eventItemsCount; i++) {
Item eventItem = relationships.getItemByIndex(i);
var data = eventItem.node.SelectNodes("./data");
string dataXml = string.Empty;
if (data.Count > 0) {
dataXml = data[0].InnerXml;
@NithinMahesh1
NithinMahesh1 / exampleCustomEventToQueue.cs
Last active July 26, 2023 14:43
Custom Event Type Queue Method
Item publishEvent = this.newItem("Method", "ehf_PublishEvent");
Item eventItem = this.newItem();
// Change the "Custom Event Type Name", "Context item id or subject string", and "Context item data" to actual values
eventItem.setProperty("type", "Custom Event Type Name");
eventItem.setProperty("subject", "Context item id or subject
string");
eventItem.setProperty("data", "Context item data");
publishEvent.setPropertyItem("event", eventItem);
Item result = publishEvent.apply();
return this;
@NithinMahesh1
NithinMahesh1 / PartBOMDLL.cs
Last active March 16, 2022 18:55
Method code for implementing Conversion Server DLL logic
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// libraries for ConversionServerFramework
using System.IO;
using Aras.ConversionFramework.Converter;
using Newtonsoft.Json.Linq;
if (System.Diagnostics.Debugger.Launch())
{
System.Diagnostics.Debugger.Break();
}
var inn = aras.IomInnovator;
var partNames = [];
var partItem = document.thisItem;
var partRels = partItem.getRelationships("Part BOM");
for(var i=0; i<partRels.getItemCount(); i++) {
//gets relationship item
var partRel = partRels.getItemByIndex(i);
let resultValue = Dscore.toFixed(1);
// Error checking for when user is inputting Relevance score and market alignment is note yet set
if(resultValue == "Infinity") {
return;
}
// This call updates the table value using the id of the cell
inArgs.resultBuilder.markToUpdateValue(Dscore_val.id, resultValue);
// Grabbing the descendant property type items from the products
let Prod_Values = Key_Diff_Root.findDescendantElements("Prod_Values");
// Handles the case when we are adding a new key differentiator
if(Prod_Values == undefined || Prod_Values.length == 0) {
return;
}
let current_marketAlignment = "";
for(let j=0; j < Prod_Values.length; j++) {
let Dscore_val = Key_Diff_Root.getPropertyItem("DScore");
let Key_Rel = Key_Diff_Root.getPropertyItem("Relevance");
if(Dscore_val.value == undefined && Key_Rel.value == undefined) {
return;
}
let Key_Diff_Root = inArgs.changedPropertyItems[0].getElement().findAncestorElement("Key_Diff");