# Connecting Autodesk & ERP

ERP systems that provide an OData interface can be directly connected to applications such as Vault Client, Inventor or AutoCAD.
But also ERP systems which doesn’t expose a web API can be connected using powerGateServer, who then acts as a middleman and translator.

## ERP integrations

Vault Clients and CAD applications can be easily connected to ERP systems using the powerGate Cmdlets or the .NET library.
Depending on whether data synchronizations must be fully automated, partially automated or performed manually, an ERP integration can be realized using powerJobs Processor, powerEvents and Autodesk Vault Data Standard (see e.g. powerGateTemplate).

### Modules

The powerGate_Connections.psm1 module is delivered in the commandlets installation directory %ProgramFiles%\coolOrange\Modules\powerGate.
It gets automatically imported with the powerGate module and provides a global $sapConnect variable for connecting to SAP systems. The$global:Host.PrivateData.OnNonTerminatingError extension ensures that Vault users are notified about connection problems and can better understand whether the problem is caused by their client-machine, by powerGateServer or directly triggered by the ERP system.

## Errors

Powershell hosting applications inform scripting guys and Vault users in different ways about Terminating Errors that arise during script or module executions :

• powerEvents displays Error Message Boxes

• The BOM Window displays Error Dialogs during Check- and Transfer operations or failure Icons while loading the BOM tree

• powerJobs Processor jobs fail

• Autodesk Vault Data Standard writes to the Log File and shows Message Boxes in several customization areas

• PowerShell IDE’s display the error message and its stack trace with red text in the terminal when the script execution stops

Instead, when Non-Terminating Errors occur within Commandlets, the script execution is not stopped by default (see -ErrorAction:Continue parameter) and further information is available in the global $Error variable. For connection problems, these would be the WebRequestException details provided by ERP cmdlets. By default, Vault users are informed about connection troubles in all types of ERP integrations using the powerGate_Connections.psm1 module. In applications such as the Vault Client, Inventor or AutoCAD a Connection Error Dialog will be displayed, which helps to understand whether the connection problem was caused by the client-machine (no request was send), the powerGateServer or directly by the ERP system (error response): All other types of Non-Terminating Errors are displayed using an Error Message Box which helps to identify incorrectly used ERP cmdlets or problematic parameters: BOM Window - Non-Terminating Errors Such modal error dialogs are not displayed during the BOM Window Check- and Transfer functions where problems with ERP cmdlets occur. Instead, the current processed$bom, $bomRow and$item objects are automatically assigned with an Error Status:

The automatically set _StatusDetails help the Vault user to localize the cause of connection problems more precisely.
Unfortunately the operations are not automatically terminated after problematic ERP cmdlet usages or incorrect parameter values, but also in this case additional stack trace information allows the scripting guy to find the problematic line faster.

Vault Restriction events - Non-Terminating Errors

All Vault Restriction events that encounter ERP cmdlet errors are automatically restricted to prevent the configured process from passing successfully even though connection or cmdlet problems have occurred:

Unfortunately, the executed Restrictions event actions are not automatically aborted directly after problematic ERP cmdlet usages or incorrected parameter values.
Still, additional stack trace information helps the script guy to quickly find and correct the affected ERP cmdlet line.

In any case, all error details are logged and can be found in the logfile.