Skip to content

$fn.createUser(param)

Add an authenticated user for the application. "asynchronous"

Arguments

NameTypeDescription
paramobjectUser information to be registered

parameters details

PropertyTypeDescription
emailstringEmail (string used for sign-in ID)
namestringName
passwordstringTemporary password
sendMailbooleantrue: Send issue mail
false: Do not send issue mail
Default is false
custom_01stringCustom Attribute 1
custom_02stringCustom Attribute 2
custom_03stringCustom Attribute 3
custom_04stringCustom Attribute 4
custom_05stringCustom Attribute 5
custom_06stringCustom Attribute 6
custom_07stringCustom Attribute 7
custom_08stringCustom Attribute 8
custom_09stringCustom Attribute 9
custom_10stringCustom Attribute 10

Return value

TypeDescription
Promise<User>Registered User Information
ObjectPropertyTypeDescription
UseruserIdstringUser ID (GUID)
emailstringEmail
namestringName
custom_01stringCustom Attribute 1
custom_02stringCustom Attribute 2
custom_03stringCustom Attribute 3
custom_04stringCustom Attribute 4
custom_05stringCustom Attribute 5
custom_06stringCustom Attribute 6
custom_07stringCustom Attribute 7
custom_08stringCustom Attribute 8
custom_09stringCustom Attribute 9
custom_10stringCustom Attribute 10
enabledbooleanEnable/Disable
createdstringCreation date and time
updatedstringUpdate date and time
statusstringUser 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);
}