Open this page in the API Guide

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var accountsService =
    new dundas.account.AccountService();
 
var 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@dundas.com";
account.password = "1234";
 
accountsService.createAccount(account)
.done(
    function (account) {
        var viewService = new dundas.view.ViewService();
        viewService.showSignal("Success");
 
        BindAccountsList();
 
    }
)
.fail(
    function(error)
    {
        var viewService = new dundas.view.ViewService();
        viewService.showSignal("Failure");
        viewService.showError(error);
    }
);