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: 

Update Change Order Routing Members (Not able to pass Routing Member)

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
sachin_charde
643 Views, 2 Replies

Update Change Order Routing Members (Not able to pass Routing Member)

Hello,

Anyone help me to pass Routing member to UpdateChangeOrderRoutingMembers method.

Thanks,

Sachin

 

 

PrivateSub UpdateMember(coID AsLong)

           

Dim coSvc AsChangeOrderService = serviceManager.ChangeOrderService

           

Dim workflow AsWorkflow = coSvc.GetDefaultWorkflow()

           

Dim routings AsRouting() = coSvc.GetRoutingsByWorkflowId(workflow.Id)

           

Dim defaultRouting AsRouting = routings.FirstOrDefault(Function(n) n.IsDflt)

           

If defaultRouting IsNothingThen

               

ThrowNewException("No default routing")

           

EndIf

           

' Not able to find how to set reference to user

           

Dim Member() AsRoutingUserRoles = ?????

 

            coSvc.UpdateChangeOrderRoutingMembers(coID, defaultRouting.Id, Member, Nothing)

       

EndSub

Tags (1)
2 REPLIES 2
Message 2 of 3

New updated code

 

now getting error code = 0

 

 

 

PrivateSub UpdateMember(coID AsLong)

 

Try

           

Dim coSvc AsChangeOrderService = serviceManager.ChangeOrderService

           

Dim workflow AsWorkflow = coSvc.GetDefaultWorkflow()

           

Dim routings AsRouting() = coSvc.GetRoutingsByWorkflowId(workflow.Id)

           

Dim defaultRouting AsRouting = routings.FirstOrDefault(Function(n) n.IsDflt)

           

If defaultRouting IsNothingThen

    ThrowNewException("No default routing")       

EndIf

             

Dim Member(1) AsRoutingUserRoles

            Member(0) =

NewRoutingUserRoles

            Member(0).UserId = 28

           

Dim arrayLong(1) AsLong

            arrayLong(0) = 8

            Member(0).RoleIdArray = arrayLong

            coSvc.UpdateChangeOrderRoutingMembers(coID, defaultRouting.Id, Member,Nothing)

       

 

Catch ex AsException

               

                MsgBox("Error: " + ex.Message)

  EndTry

EndSub

Message 3 of 3
minkd
in reply to: sachin_charde

In order to add users to a Change Order routing, you also need to specify which change order roles that user should have within the routing.

 

The RoutingUserRoles object (which you pass in arrays of to add / delete those user/roles) contains the userID of the user you want to add. In your case it appears you are working with userID 28, which I assume is a valid user ID.

 

So what is missing is the array of role IDs that you want to give the user.

 

The available role definitions can be determined with the GetRoutingRoleDefinitionsByWorkflowId method, which returns an array of RoutingRoleDef objects. Each one of those contains an ID, a localized name, and what kind of changes the signed-in user is allowed to make (add, remove, both, none).

 

-Dave

 



Dave Mink
Fusion Lifecycle
Autodesk, Inc.

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

Post to forums  

Autodesk Design & Make Report