Showing results for 
Search instead for 
Do you mean 

Help creating instance of Role type

Loyal Listener
Posts: 19
Country: USA

Help creating instance of Role type

I need to create a user record in the database and am calling the CreateUser() method with the following parameters:

User loUser = toActFramework.Users.CreateUser(lcUserlogon, lcPassword, loRole, toContact, loStatus, llSyncHandhelds, llUseAccountingLink);

I have been able to get the correct parameter values for all but the Role type.

How do I properly populate the Role type so that it can be passed to CreateUser()?

Posts: 1,163
Country: USA

Re: Help creating instance of Role type

Hope this helps!


Act.Framework.Roles.Role[] Roles = _ActApp.ActFramework.Roles.GetRolesList();
UserMgr.CreateUser("Chris Huffman""", Roles[0], _ActApp.ApplicationState.CurrentContact, Status.Active, truetrue);
Matthew Wood
Act! SDK Support
Community Moderator
Astute Commentator
Posts: 10
Country: Russia

Re: Help creating instance of Role type

[ Edited ]


you can use  RoleManager class:

namespace Act.Framework.Roles
    public sealed class RoleManager : GeneralManager
        public Role Role_Administrator;
        public Role Role_Browse;
        public Role Role_Manager;
        public Role Role_Restricted;
        public Role Role_Standard;


Sample code:


public class ActHelper
private ActFramework _act;

public class ActUserInfo
public string UserName;
public string Password;
public string ContactName;

public bool CreateNewUser(ActUserInfo userInfo) { if (_act == null) return false; User newUser = null; try { newUser = _act.Users.CreateUser(userInfo.UserName, userInfo.Password,
, new ContactName(userInfo.ContactName),
Act.Framework.Users.Status.Active, false, false); } catch { } return newUser != null; }