AccountService.createAccount Method

Creates an account with the specified options. The ID field should be left empty, as the result will have it set to the new ID.
 

Parameters

account

Type: Account
The account object that should be created.

Return Value


Type: jQuery.Promise
Value: dundas.account.Account
A promise object that is resolved when the call is complete. If successful, a dundas.account.Account is returned. 

Examples

This creates a new local user account object.




        const accountService = dundas.context.getService("AccountService");
        const account = new dundas.account.Account();

        account.accountType = dundas.account.AccountType.LOCAL_USER;
        account.id = "2f3224b1-9484-4a84-8963-d6172743a9ef";
        account.name = "MyUserAccount";
        account.displayName = "MyDisplayName";
        account.emailAddress = "myemailaddress@example.com";
        account.password = "ChangeThis1234!";
		account.isEnabled = true;
		account.isGlobal = true;

        accountService.createAccount(account).done((account) => {
            dundas.context.getService("ViewService").showSignal("Success");
            BindAccountsList();
        }).fail((error) => {
            const viewService = dundas.context.getService("ViewService");
            viewService.showSignal("Failure");
            viewService.showError(error);
        });