$fn.createUser(param)
Add an authenticated user for the application. "asynchronous"
Arguments
| Name | Type | Description |
|---|---|---|
| param | object | User information to be registered |
parameters details
| Property | Type | Description |
|---|---|---|
| string | Email (string used for sign-in ID) | |
| name | string | Name |
| password | string | Temporary password |
| sendMail | boolean | true: Send issue mail false: Do not send issue mail Default is false |
| custom_01 | string | Custom Attribute 1 |
| custom_02 | string | Custom Attribute 2 |
| custom_03 | string | Custom Attribute 3 |
| custom_04 | string | Custom Attribute 4 |
| custom_05 | string | Custom Attribute 5 |
| custom_06 | string | Custom Attribute 6 |
| custom_07 | string | Custom Attribute 7 |
| custom_08 | string | Custom Attribute 8 |
| custom_09 | string | Custom Attribute 9 |
| custom_10 | string | Custom Attribute 10 |
Return value
| Type | Description |
|---|---|
Promise<User> | Registered User Information |
| Object | Property | Type | Description |
|---|---|---|---|
| User | userId | string | User ID (GUID) |
| string | |||
| name | string | Name | |
| custom_01 | string | Custom Attribute 1 | |
| custom_02 | string | Custom Attribute 2 | |
| custom_03 | string | Custom Attribute 3 | |
| custom_04 | string | Custom Attribute 4 | |
| custom_05 | string | Custom Attribute 5 | |
| custom_06 | string | Custom Attribute 6 | |
| custom_07 | string | Custom Attribute 7 | |
| custom_08 | string | Custom Attribute 8 | |
| custom_09 | string | Custom Attribute 9 | |
| custom_10 | string | Custom Attribute 10 | |
| enabled | boolean | Enable/Disable | |
| created | string | Creation date and time | |
| updated | string | Update date and time | |
| status | string | User Status |
Sample
try { /* CSV content * ----------------------------------------------------- * "email","name","password","sendMail" * "user01@test.co.jp","User01","Password@01",true * "user02@test.co.jp","User02","Password@02",false * ----------------------------------------------------- */ const file = await $fn.getFile('/userInfo.csv'); const buffer = file.data; const userInfos = $fn.csvToObject(buffer); for (let userInfo of userInfos) { console.log(JSON.stringify(userInfo)); let data = {}; data = { email: userInfo['email'], name: userInfo['name'], password: userInfo['password'], sendMail: JSON.parse(userInfo['sendMail']) }; // Add User let result=await $fn.createUser(data); if(result.errorType){ throw new Error (result.errorMessage); } }} catch(err) { console.log("Error", err.message);}