Sample.ConnectToERP

This client customization shows how to automatically connect to all configured ERP Services when Vault users log into Vault from within the Vault Client or Inventor.
It adds a menu item in the Tools menu of the Vault Client to open the ERP Integration Settings dialog, where these connection settings can be viewed and changed.

Evaluating sample ERP features is possible out-of-the-box. No manual configuration in the Vault is required for this, as our public Demo ERP system is used by default.

Modifications

To modify this script to your needs, it is recommended to create a copy of the sample script, customize it accordingly and then disable this sample script.

The sample script registers to the LoginVault_Post event and tries to connect to all configured ERP services using Connect-ERP -UseSettingsFromVault.
But also after saving changes in the ERP Integration Settings dialog, this cmdlet is invoked again.

The following script section can be adapter if connections to these services might not be supported by default or additional connection procedures are required:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
function ConnectToConfiguredERPServices(){
   Disconnect-ERP

   # multiple SAP Gateway services are configured as 'Direct connection to an OData-capable ERP'
   Connect-ERP -UseSettingsFromVault -OnConnect {
      param($settings)

      $settings.Credentials = New-Object System.Net.NetworkCredential('EX_DEMO', 'secret')

      if($settings.Service.EndsWith('/sap/opu/odata/arcona6/MATERIAL_SRV')) {
         $global:sapConnect.Invoke($settings)

         # Other custom -OnConnect logic ...
      }elseif(...){ ... }
   }
}

Disabling the script

After the installation on new environments this script is enabled by default for the Vault Client and Inventor.
To globally disable this client customization, move the script file to the %PROGRAMDATA%\coolOrange\Client Customizations\Disabled directory.

Note

Please note that after updates from v23.0.10 and older, this script is automatically disabled and installed in the %PROGRAMDATA%\coolOrange\Client Customizations\Disabled directory.
Scripting guys can then enable and review this customization in a test environment before deploying the script in production ERP integrations.