Does anyone have any experience using the AccountServices API?

Hi,

I’m trying to create a dashboard that would have the list of users and then update their information from there?

If you have any experience on this, could you share a sample script on how this could be implemented?

Regards,
Renzi

Not sure exactly what you’re trying to do…

Here’s a script that goes through all the users in a given group and changes one of the account permissions for each.

//Sets the 'Can Change Password' checkbox for all users associated with a particular group

groupID = "????????????????";     ///Set the GUID of the group of accounts you want to update

var groupService = dundas.context.getService("GroupService");
var accountService = dundas.context.getService('AccountService');
groupService.groupMembers(groupID, true).done(function (member)
{
	member[0].forEach(function (accId)
	{
		accountService.getAccountById(accId.id).done(function (account)
		{
			account.canChangePassword = true;
			accountService.updateAccount(account);
		}
		)
	}
	)
}
)
3 Likes

@david.glickman, yes that is somehow what I want to do. Also, update any info related to the account like Display name, email, etc. But the sample script you posted is a great help in pointing me to the right direction.

1 Like

The main steps are

  1. Get the account service
  2. Get the account
  3. Change something in the account you have
  4. Update the account
1 Like

thank you @david.glickman