We’ve developed some resources to help you work effectively from home during COVID-19 Click to learn more

Mass update user accounts

Hi everyone,

I'm not sure if this is the correct forum but we've got a nice challange from a customer. We have a 250 user customer and they are using AD authentication for all users.

due to internal changes they don't want to use AD authentication anymore and have to switch back to SuperOffice authentication.

Is it possible to change the authentication type to SuperOffice and set a default password for all users via scripting or the API, or do we have to update each account manually? I've found some classes in CRM Script but i'm not sure if or how we can use these.

RE: Mass update user accounts


We faced the same challenge recently with a 350 users customer to change everyone from AD to SuperOffice Auth (Sadly no support for AAD for SuperOffice OnSite....), we solved it by developing an entire password reset tool which also sends emails etc.

But the basic logic in CRMScript would be something like this:

NSUserAgent userAgent;

SearchEngine seAssociates;

// not retired
seAssociates.addCriteria("associate.deleted", "OperatorEquals", "0");

// employee
seAssociates.addCriteria("associate.type", "OperatorEquals", "0");

for (seAssociates.execute(); !seAssociates.eof(); seAssociates.next())
  	Integer associateId = seAssociates.getField("associate.associate_id").toInteger();
    NSUser user = userAgent.GetUser(associateId);
  	printLine("Processing user '" + user.GetUserName() + "'");
    NSCredential[] credentials = user.GetCredentials();
    NSCredential[] newCredentials;

    for (Integer i; i < credentials.length(); i++)
        NSCredential credential = credentials[i];
        NSCredentialType credentialType = credential.GetType();

        // if not AD credential type, add back to credentials array
        if (credentialType.GetType().equalsIgnoreCase("ActiveDirectory") == false)
            printLine("Remove AD credential from '" + user.GetUserName() + "'");

    user = userAgent.SaveUser(user);

    // generate new password;
    //String password = "do-some-password-gen";
    //userAgent.SetPassword(user.GetAssociateId(), password);
    printLine("Set net password for user '" + user.GetUserName() + "'");

NOTE: Not tested on production environment, use at your own risk!

Von: David Hollegien 23. Apr 2020

RE: Mass update user accounts

Hi David,

Thanks, we will look into this :-)

Von: Alexander Hesselberth 23. Apr 2020

RE: Mass update user accounts


It should also be possible to do via the REST API.

We have customer that at least has been able to develop a against the REST-API to add users. 

Therefor I think it should be possible also to make changes this way?


Best regards


Von: Anders Larsson 23. Apr 2020