Vault markup return process

Vault markup return process

esimers
Enthusiast Enthusiast
418 Views
5 Replies
Message 1 of 6

Vault markup return process

esimers
Enthusiast
Enthusiast

Ok so we have a process that we want to implement.  We currently have our PDFs stored on a network filestorage (printroom).  

What I want to do is let workers on the shop floor access the PDFs and if they need to mark up the drawings they some how start the ECO process within Vault.

 

Currently we have a custom iOS compatible web app that looks up the pdf  they want opens it in safari. 

 

I have attempted to use the Vault Mobile app but unless I am really stupid the only thing I can save for markups is a .png and it's local save on the ipad, and we don't really need everyday workers in the vault anyways.

 

I am trying to see if I can use a custom job processor to start the ECO process.  I have used the Samples in the API onboarding and managed to get custom job to the processor, but how do I actually make the custom job or workflow I want to carry out?  

 

I'm so frustrated with coding, I can't seem to understand all of it.  I've been in Autodesk products as a user since 1998.  But now I finally got a change to enhance my abilities and I am CAD system admin, but coding is my kryptonite currently. 

 

Thanks have a super awesome day.

0 Likes
419 Views
5 Replies
Replies (5)
Message 2 of 6

Markus.Koechl
Autodesk
Autodesk

You can find sample code on how to create ECOs here: 
Powershell: VDS-Sample-Configurations-2025/VDS-PDMC-Sample-Vault/Vault.Custom/addinVault/Menus/ADSK.QS.CreateECO...
C#: Vault-Sample---Change-Mangement-Extension/ChangeMgmtExt/ChangeMgmtExtension.cs at OTX2016Release · k...
This is pure code, so I am not sure that these links are of direct help if you are not into programming. 



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
0 Likes
Message 3 of 6

esimers
Enthusiast
Enthusiast

I am trying to learn to code in c# with .net  Thank you for the link.  I'm trying to start the ECO process basically passing through the information via a webapp.  Because it seems I cannot get PDF markups to save back to vault via an iPad.

 

 

0 Likes
Message 4 of 6

esimers
Enthusiast
Enthusiast

I'm trying to mess with this stuff but 

// Get the default numbering scheme
ChangeOrderNumSchm[] numberingSchemes =
    mVault.ChangeOrderService.GetNumberingSchemesByType(NumSchmType.ApplicationDefault);
ChangeOrderNumSchm defaultNumberingScheme = numberingSchemes.FirstOrDefault();
if (defaultNumberingScheme == null)
    throw new Exception("No default numbering scheme found");

 

Visual Studio is hung up on this part, and I can't find ChangeOrderNumSchm anywhere at all.

0 Likes
Message 5 of 6

esimers
Enthusiast
Enthusiast

I can't get this to work @Markus.Koechl  

I get errors when trying to run it.  It errors on trying to make the new change order and I don't understand why, I've tried so many things I'm basically lost.

there is something I'm not doing right with the change order number id.  I can get it I know what the number is, but only if I put null it will run but gives errors because it can't find the number id....

 

 using System;
using System.Linq;
using System.Runtime.CompilerServices;
using Autodesk.Connectivity.WebServices;
using Autodesk.Connectivity.WebServicesTools;
using Autodesk.DataManagement.Client.Framework.Vault.Currency.Connections;
using Autodesk.DataManagement.Client.Framework.Vault.Services.Connection; // Keep if needed, but login uses WebServices directly here

namespace API_Onboarding_ConsoleApp2
{
    class Program
    {
        private static readonly string CO_ENTITY_CLASS_ID;

        static void Main(string[] args)
        {
            // --- Connection Settings ---
            string dataServer = "1.1.1.1"; // Server
            string vaultName = "VAULT";
            string userName = "Administrator";
            string password = "**********"; // Consider more secure way?

            WebServiceManager vaultConnection = null;

            try
            {
                // --- Connect To Vault ---
                ServerIdentities serverId = new ServerIdentities
                {
                    DataServer = dataServer,
                    FileServer = dataServer // Often the same as DataServer
                };
                UserPasswordCredentials credentials = new UserPasswordCredentials(serverId, vaultName, userName, password, LicensingAgent.Client);
                vaultConnection = new WebServiceManager(credentials); // Logs in

                Console.WriteLine("Successfully logged into Vault.");

                // --- Prepare ECO Data ---
                string ecoTitle = "New Design Change (via API)";
                string ecoDescription = "Implementation of design modifications (via API)";
                DateTime dueDate = DateTime.Now.AddDays(30); // Example due date



                // --- 2. Get Numbering Scheme ID ---
                getChangeOrderRoutingId.ListAvailableRoutings(vaultConnection);
                long numbSchemeId = listChangeOrderNumberSchemes.ListAvailableCOSchemes(vaultConnection);
                if (numbSchemeId == -1)
                {
                    throw new Exception("Failed to find the required ECO numbering scheme.");
                }




                // --- 3. Get Routing ID ---
                Console.WriteLine("\nChecking for PMC-ECO-ROUTE...");
                ChangeOrderService coService = vaultConnection.ChangeOrderService;

                // Get default workflow and its routings
                Workflow workflow = coService.GetDefaultWorkflow();
                Routing[] routings = coService.GetRoutingsByWorkflowId(workflow.Id);
                

                // Find the specific routing by name
                string desiredRoutingName = "PMC-ECO-ROUTE";
                Routing targetRouting = routings?.FirstOrDefault(r => r.Name.Equals(desiredRoutingName, StringComparison.OrdinalIgnoreCase));

                if (targetRouting == null)
                {
                    throw new Exception($"Could not find the routing '{desiredRoutingName}'. Please check Vault configuration.");
                }

                // Set this as the default routing
                coService.SetDefaultRouting(targetRouting.Id);
                Console.WriteLine("Confirmed PMC-ECO-ROUTE");


                // --- 4. Create the Change Order ---
                Console.WriteLine("\nAttempting to create ECO...");
                try
                {
                    // Ensure all required parameters are valid
                    if (targetRouting == null)
                    {
                        throw new Exception("Routing or Numbering Scheme is not properly initialized.");
                    }

                    // Validate dueDate to ensure it is not in the past
                    if (dueDate <= DateTime.Now)
                    {
                        throw new Exception("The due date must be in the future.");
                    }

                    // Create the ECO

 //                   ChangeOrder newEco = coService.AddChangeOrder(
 //                       ecoTitle,           // title
 //                       ecoDescription,     // description
 //                       dueDate,            // dueDate
 //                       targetRouting.Id,          // routingId
 //                       categoryId,         // categoryId
 //                       defaultNumScheme.SchmID,        // <<< Pass the scheme ID here
 //                       new long[0],        // fileMastIds
 //                       new long[0],        // itemMastIds
 //                       null                // propInsts
 //);
                    ChangeOrder newEco = coService.AddChangeOrder(
                    targetRouting.Id,        // long routingId
                    null,                    // string changeOrderNumber (Using null for auto-numbering)
                    ecoTitle,                // string title
                    ecoDescription,          // string description
                    dueDate,                 // DateTime approveDeadline
                    new long[0],             // long[] itemMasterIds
                    new long[0],             // long[] attachmentIds
                    new long[0],             // long[] fileMasterIds
        null,                    // PropInst[] properties
        null,                    // AssocPropItem[] assocProperties
        null,                    // MsgGroup[] comments
        null                     // Email[] notifyEmails
                );

                    Console.WriteLine($"Successfully created ECO: {newEco.Num} (ID: {newEco.Id})");
                }
                catch (Exception ex)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("\n--- Failed to create ECO ---");
                    Console.WriteLine($"Error Code: {ex.Message}");
                    Console.WriteLine($"Stack Trace: {ex.StackTrace}");
                    Console.ResetColor();
                }

                // --- Optional: Add files/items or transition state here ---
                // coService.AddChangeOrderItems(...)
                // coService.UpdateChangeOrderState(...)


            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("\n--- An error occurred ---");
                Console.WriteLine($"Error Message: {ex.Message}");
                Console.WriteLine($"Stack Trace: {ex.StackTrace}");
                // Log the exception details appropriately
                Console.ResetColor();
            }
            finally
            {
                // --- Logout/Dispose ---
                // Ensure the connection is disposed to release resources and license
                // --- Logout/Dispose ---
                if (vaultConnection != null)
                {
                    Console.WriteLine("\nLogging out...");
                    vaultConnection.Dispose(); // This logs out and cleans up
                    Console.WriteLine("Logged out.");
                }

            }

            Console.WriteLine("\nPress Enter to exit.");
            Console.ReadLine();
        }
    }
}

 

0 Likes
Message 6 of 6

Markus.Koechl
Autodesk
Autodesk

Hi @esimers , my shared code reflected Vault 2016, we need to make some updates. Find an updated sample here: Vault-API-Snippets-and-Samples/Vault-API-C#-Samples/ECO/API-Onboarding-Create-ECO/Program.cs at mast...

I hope this helps to resolve your task.



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
0 Likes