Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AddChangeOrder Example?

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
thomaskennedy
499 Views, 4 Replies

AddChangeOrder Example?

Does anybody have a working example of creating a change order via the API in 2013? (.NET)

I've been playing around but keep getting Soap Exception 106. 

 

Thanks in advance,

Tom

4 REPLIES 4
Message 2 of 5
minkd
in reply to: thomaskennedy

The 106 error indicates that you are trying to call a method prior to signing-in as a user.

 

-Dave



Dave Mink
Fusion Lifecycle
Autodesk, Inc.
Message 3 of 5
thomaskennedy
in reply to: minkd

Hmm, well I thought I was logging in correctly but perhaps not.

Here's what I've got so far:

 

        Dim login As New UserPasswordCredentials("ellisws1", "Routing", "Administrator", "")

        Using serviceManager As New WebServiceManager(login)

            Try
                Dim myeco As ChangeOrderService
                myeco = New ChangeOrderService

                ' get the default routing 
                Dim workflow As Workflow = myeco.GetDefaultWorkflow()
                Dim routings As Routing() = myeco.GetRoutingsByWorkflowId(workflow.Id)
                Dim defaultRouting As Routing = routings.FirstOrDefault(Function(n) n.IsDflt)
                If defaultRouting Is Nothing Then
                    Throw New Exception("No default routing")
                End If

                ' get the next number in the default sequence 
                Dim numberingSchemes As ChangeOrderNumSchm() = _
                    myeco.GetNumberingSchemesByType(NumSchmType.ApplicationDefault)
                Dim defaultNumberingScheme As ChangeOrderNumSchm = numberingSchemes.FirstOrDefault()
                If defaultNumberingScheme Is Nothing Then
                    Throw New Exception("No default numbering scheme")
                End If
                Dim coNumber As String = myeco.GetChangeOrderNumberBySchemeId(defaultNumberingScheme.Id)

                Dim newCo As ChangeOrder = myeco.AddChangeOrder(defaultRouting.Id, coNumber, "test", "testing desc", DateTime.Now.AddMonths(1), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing)

            Catch ex As Exception
                MessageBox.Show(ex.Message, "Error creating ECO")
                Return
            End Try

        End Using

 

The 106 error comes from the GetDefaultWorkflow function.

 

Any advice?

Thanks.

 

Message 4 of 5
Redmond.D
in reply to: thomaskennedy

Don't new-up any of the Service objects.  The WebServiceManager takes care of all that.

 

Replace the line

     myeco = New ChangeOrderService

with

     myeco = serviceManager.ChangeOrderService

 

That should get your farther in your code.



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 5 of 5
thomaskennedy
in reply to: Redmond.D

Ahhh. That makes sense.

Its working now.

 

Thanks!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report