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 with routing cause problem

1 REPLY 1
Reply
Message 1 of 2
wesbird
310 Views, 1 Reply

update change order with routing cause problem

Hi, 

 

  I'm new to Vault and plan to create a customized function to create Change Order. It works. after that, I use UpdateChangeOrderRoutingMembers to add routing to change order. then I got error message when I switch to tab Routing. Here is the error message: 

 

The given key was not present in the dictionary.

 

I'm wondering if it related to the security setting I did. I setup security according to Folder.

Folder $CIBC only managed by user group "CIBC CAFM" and user Administrator.

user group "CIBC CAFM" only contain user lisav, Roles is "Document Editor (Level 1), Change Order Editor (Level 2)

user lisav does not have any roles.

  I tried a couple of thing but nothing works.

  1. change user group "CIBC CAFM" roles to "Document Editor (Level 1), Change Order Editor (Level 1)”

  2. change lisav's role to “Change Order Editor (Level 2)”

 

 

Here is the code to get the User from userGroup (here userGroup = "CIBC CAFM")

 

        public List<User> GetUserFromUserGroup(string userGroup)
        {
            IEnumerable<Group> groups = _adminSvc.GetAllGroups().Where(n => string.Compare(n.Name, userGroup, true) == 0);
            GroupInfo[] groupInfos = _adminSvc.GetGroupInfosByGroupIds(groups.Select(n => n.Id).ToArray());
            List<User> ret = new List<User>();
            foreach (var a in groupInfos)
                foreach (var b in a.Users)
                    ret.Add(b);

            return ret;
        }

 here is the code to get RoutingUserRoles from client ("CIBC CAFM")

        public RoutingUserRoles[] GetMembers(string client)
        {
            List<User> users = GetUserFromUserGroup(client);

            RoutingUserRoles[] member = new RoutingUserRoles[users.Count];

            for (int i = 0; i < users.Count; i++)
            {
                member[i] = new RoutingUserRoles();
                member[i].UserId = users[i].Id;

                long[] arrayLong = new long[1];
                arrayLong[0] = 2;  // 2: Change Administrator
                member[i].RoleIdArray = arrayLong;
            }

            return member;
        }

 Here is the code to add routing to change order:

            RoutingMembAndRoles rmar = helper.coHelper.ChangeOrderService.UpdateChangeOrderRoutingMembers(
                newCo.Id,
                defaultRouting.Id,
                member,
                null);

 

 

Thank

Wes

 

Windows 10 64 bit, AutoCAD (ACA, Map) 2023
1 REPLY 1
Message 2 of 2
wesbird
in reply to: wesbird

Hi:

 

  when I run the code this morning, It suddenly works. I do change some code, but I don't think anything affect it. If it happen again, I will see if I can provide more detail. now I have to close this case. Sorry to bother you for your time. 

 

 

Thank you 

Wes

Windows 10 64 bit, AutoCAD (ACA, Map) 2023

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

Post to forums  

Autodesk Design & Make Report