ビルトイン関数
アクションには最初から用意されている関数があります。これをビルトイン関数と呼びます。 ビルトイン関数はオブジェクト$fnのメソッドに該当し$fn.XXXの形式で呼び出すことができます。
$fn.addUsers(param)
アプリケーションの認可グループにユーザを追加します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
param | object | グループ名と追加するユーザ情報 |
param詳細
プロパティ | 型 | 説明 |
---|---|---|
groupName | string | グループ名 |
emails | array of string | グループに加えるユーザのメールアドレス配列 |
戻り値
なし
サンプル
try { /* CSV の内容 * --------------------------- * "email" * "user01@test.co.jp" * "user02@test.co.jp" * --------------------------- */ const file = await $fn.getFile('/addUsers.csv'); const buffer = file.data; const addUsers = $fn.csvToObject(buffer); const emails = addUsers.map(function (item) { return item['email']; }); // 認可グループ「Group01」にユーザ追加 await $fn.addUsers({ groupName: "Group01", emails: emails });}catch(err) { console.log("Error", err);}
$fn.createFolder(path)
指定パスにフォルダを作成します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
path | string | 作成するフォルダのパス |
戻り値
なし
サンプル
try { await $fn.createFolder('/folder1');} catch (err) { console.log("Error", err);}
$fn.createGroup(param)
アプリケーションの認可グループを追加します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
param | object | 登録するグループ情報 |
param詳細
プロパティ | 型 | 説明 |
---|---|---|
groupName | string | グループ名 |
description | string | 詳細 |
戻り値
型 | 説明 |
---|---|
Promise<Group> | 登録したグループ情報 |
オブジェクト | プロパティ | 型 | 説明 |
---|---|---|---|
Group | groupName | string | グループ名 |
description | string | 説明 | |
members | object array | グループに所属するアクティブユーザ配列 |
サンプル
const groupName = $ui.groupName.value;const description = $ui.description.value;try { await $fn.createGroup({ groupName: groupName, description: description });} catch (err) { console.log("Error", err);}
$fn.createUser(param)
アプリケーションの認証ユーザを追加します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
param | object | 登録するユーザ情報 |
param詳細
プロパティ | 型 | 説明 |
---|---|---|
string | Eメール(サインインIDに使用する文字列) | |
name | string | 名前 |
password | string | 一時パスワード |
sendMail | boolean | true:発行メール送信する false:発行メール送信しない デフォルトはfalse |
custom_01 | string | カスタム属性1 |
custom_02 | string | カスタム属性2 |
custom_03 | string | カスタム属性3 |
custom_04 | string | カスタム属性4 |
custom_05 | string | カスタム属性5 |
custom_06 | string | カスタム属性6 |
custom_07 | string | カスタム属性7 |
custom_08 | string | カスタム属性8 |
custom_09 | string | カスタム属性9 |
custom_10 | string | カスタム属性10 |
戻り値
型 | 説明 |
---|---|
Promise<User> | 登録したユーザ情報 |
オブジェクト | プロパティ | 型 | 説明 |
---|---|---|---|
User | userId | string | ユーザID (GUID) |
string | Eメール | ||
name | string | 名前 | |
custom_01 | string | カスタム属性1 | |
custom_02 | string | カスタム属性2 | |
custom_03 | string | カスタム属性3 | |
custom_04 | string | カスタム属性4 | |
custom_05 | string | カスタム属性5 | |
custom_06 | string | カスタム属性6 | |
custom_07 | string | カスタム属性7 | |
custom_08 | string | カスタム属性8 | |
custom_09 | string | カスタム属性9 | |
custom_10 | string | カスタム属性10 | |
enabled | boolean | 有効/無効 | |
created | string | 作成日時 | |
updated | string | 更新日時 | |
status | string | ユーザのステータス |
サンプル
try { /* CSV の内容 * ------------------------------------------------------ * "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']) }; // ユーザ追加 let result=await $fn.createUser(data); if(result.errorType){ throw new Error (result.errorMessage); } }} catch(err) { console.log("Error", err.message);}
$fn.csvToObject(csv)
指定したCSVファイルデータをオブジェクト形式に変換します。
引数
名前 | 型 | 説明 |
---|---|---|
csv | Buffer | CSVファイルのBufferオブジェクト |
CSVファイルの仕様
ヘッダ行 | 必須 オブジェクトのプロパティ名になります。 半角英数字のみ可能です。 (数字開始は不可) 例)“email”, “name” |
区切り文字 | ,(カンマ) |
フィールド | 値にダブルクォーテーション、カンマ、改行を含む場合は、必ず囲ってください。 |
改行コード | CRLF または LF |
文字コード | UTF-8 |
BOM | BOMなし または BOM付 |
戻り値
型 | 説明 |
---|---|
array of object | CSVファイルデータをオブジェクト形式に変換して返却します |
サンプル
try { /* CSVの内容 * ------------------------------------------------------------------- * Id,Title,Description,Progress,Category,CreatedBy,CreatedAt * 00001,タイトル1,"説明1, サンプル1",100,CATEGORY1,User1,2023-08-01 * 00002,タイトル2,"説明2, サンプル2",80,CATEGORY2,User2,2023-08-10 * 00003,タイトル3,"説明3, サンプル3",20,CATEGORY3,User3,2023-08-12 * ------------------------------------------------------------------- */ const file = await $fn.getFile("/path/to/projects.csv"); const buffer = file.data; // CSVファイルをパースし、オブジェクトへ変換 const projects = $fn.csvToObject(buffer); // 1件ずつデータを登録 for (const project of projects) { const { Id, Title, Description, Category, Progress, CreatedBy, CreatedAt } = project; if (!Id) { throw new Error("IDが入力されていません。"); } const progress = Number(Progress); if (isNaN(progress)) { throw new Error("進捗率は数値で入力して下さい。"); } /* SQL 関数の内容 * ------------------------------------------------------------------------------------ * insert into Project VALUES (${param.id},${param.title},${param.description}, * ${param.progress},${param.category},${param.createdBy},${param.createdAt}); * ------------------------------------------------------------------------------------ */ // SQL関数でテーブルにデータを登録 await insertToProjectTable({ id: Id, title: Title, description: Description, progress, category: Category, createdBy: CreatedBy, createdAt: CreatedAt }); }} catch (e) { console.error(e);}
$fn.deleteFile(path)
指定パスにあるファイルを削除します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
path | string | 削除するファイルのパス |
戻り値
なし
サンプル
try { await $fn.deleteFile('/note.txt'); } catch (err) { console.log("Error", err); }
$fn.deleteFolder(path)
指定パスにあるフォルダを削除します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
path | string | 削除するフォルダのパス |
戻り値
なし
サンプル
try { await $fn.deleteFolder('/folder1');} catch (err) { console.log("Error", err);}
$fn.deleteUser(email)
アプリケーションの認証ユーザを削除します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
string | 削除するユーザのEメール |
戻り値
なし
サンプル
try { /* CSV の内容 * --------------------------- * "email" * "user01@test.co.jp" * "user02@test.co.jp" * --------------------------- */ const file = await $fn.getFile('/userInfo.csv'); const buffer = file.data; const userInfos = $fn.csvToObject(buffer); const emails = userInfos.map(function (item) { return item['email']; }); // ユーザ削除 for (let email of emails) { console.log(email); await $fn.deleteUser(email); }} catch(err) { console.log("Error", err);}
$fn.download(file, filename)
指定したファイルをローカルにダウンロードします。ダウンロードするファイル名を指定することができます。
[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
file | Buffer | ダウンロードするファイルのBufferオブジェクト |
filename | string | ダウンロードするファイル名 |
戻り値
なし
サンプル
try { const file = await $fn.getFile('/note.json'); const buffer = file.data; // File Download await $fn.download(buffer, 'download.json');} catch (err) { console.log("Error", err);}
$fn.getCurrentPosition()
スマートフォン端末の現在位置を取得します。
引数
なし
戻り値
型 | 説明 |
---|---|
GeolocationCoordinates | デバイスの位置情報 |
サンプル
const position = $fn.getCurrentPosition();
const latitude = position.latitude;
const longitude = position.longitude;
$fn.getCurrentUser()
サインインしているユーザを取得します。[非同期]
引数
なし
戻り値
型 | 説明 |
---|---|
User | サインイン中のユーザを返却します |
オブジェクト | プロパティ | 型 | 説明 |
---|---|---|---|
User | userId | string | ユーザID (GUID) |
string | Eメール | ||
name | string | 名前 | |
custom_01 | string | カスタム属性1 | |
custom_02 | string | カスタム属性2 | |
custom_03 | string | カスタム属性3 | |
custom_04 | string | カスタム属性4 | |
custom_05 | string | カスタム属性5 | |
custom_06 | string | カスタム属性6 | |
custom_07 | string | カスタム属性7 | |
custom_08 | string | カスタム属性8 | |
custom_09 | string | カスタム属性9 | |
custom_10 | string | カスタム属性10 | |
enabled | boolean | 有効/無効 | |
created | string | 作成日時 | |
updated | string | 更新日時 | |
status | string | ユーザのステータス |
サンプル
try { const user = await $fn.getCurrentUser(); console.log(user);} catch (err) { console.log("Error", err);}
$fn.getFile(path)
指定パスのファイルを取得します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
path | string | 取得するファイルのパス |
戻り値
型 | 説明 |
---|---|
Promise<{data: Buffer}> | Amazon S3から取得するバイナリデータ(data:Buffer型)をプロパティに持つオブジェクト |
サンプル
try { const file = await $fn.getFile('/note.json'); const buffer = file.data; // JSON object const obj = JSON.parse(buffer.toString()); } catch (err) { console.log("Error", err); }
$fn.getFileNames(path)
指定ディレクトリパスにあるファイル名のリストを取得します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
path | string | 取得するディレクトリのパス |
戻り値
型 | 説明 |
---|---|
array of string | ターゲットディレクトリ内のファイル名のリスト |
サンプル
try { const files = await $fn.getFileNames('/folder1');} catch (err) { console.log("Error", err);}
$fn.getGroups(option)
ユーザマネージャに存在するすべてのグループを取得します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
option | object | グループに所属するユーザを含めるか指定 |
option詳細
名前 | 型 | 説明 |
---|---|---|
containUsers | boolean | true: グループに所属するユーザを含める false: グループに所属するユーザを含めない デフォルトはtrue |
戻り値
型 | 説明 |
---|---|
Promise<Group[]> | グループリスト |
オブジェクト | プロパティ | 型 | 説明 |
---|---|---|---|
Group | groupName | string | グループ名 |
description | string | 説明 | |
members | object array | グループに所属するアクティブユーザ配列 |
サンプル
try { // グループに所属するユーザを含めないグループ情報を取得 const groups = await $fn.getGroups({containUsers:false}); console.log(groups);} catch (err) { console.log("Error", err);}
$fn.getLanguage()
現在表示している言語を取得します。
引数
なし
戻り値
型 | 説明 |
---|---|
string | [default | en | ja] のいずれかの値を返します |
サンプル
const lang = $fn.getLanguage();
$fn.getPresignedUrl(path,options)
WebPerformerNXの実行環境にあるファイルマネージャに対してアクセスするための署名付きURLの発行します。[非同期]
引数
名前 | 型 | 説明 | ||||||
---|---|---|---|---|---|---|---|---|
path | string |
| ||||||
options | object | 署名付きURLの有効時間 |
options詳細
プロパティ | 型 | 説明 |
---|---|---|
expiresIn | number | 署名付きURLの有効時間(秒) デフォルトは900 |
戻り値
型 | 説明 |
---|---|
string | 署名付きURL |
サンプル
// ファイルパスにクエリパラメータ(キャッシュ:保存しない、MIMEタイプ:application/pdf)指定const path = $ui.filePath.value + "\?response-cache-control=no-store&response-content-type=application/pdf";// 有効時間10分の署名付きURLを発行$ui.url.value = await $fn.getPresignedUrl(path, {expiresIn:600});
$fn.getUploadFiles()
プッシュボタンやアイコンボタンでアップロードしたファイルを取得します。[非同期]
引数
なし
戻り値
型 | 説明 |
---|---|
Promise <FileInfo[]> | アップロードしたファイル情報 |
オブジェクト | プロパティ | 型 | 説明 |
---|---|---|---|
FileInfo | data | Buffer | ファイルデータ |
filename | string | ファイル名 | |
filesize | number | ファイルサイズ |
サンプル
try { // 戻り値はオブジェクトの配列 const files = await $fn.getUploadFiles(); await Promise.all(files.map(async (file) => { const path = `/uploads/${file.filename}`; // 指定パスへファイルを保存 await $fn.putFile(path, { data: file.data, }); }));} catch (err) { console.error("Error ", err);}
$fn.getUsers(groupName?,option)
ユーザマネージャに存在するユーザを取得します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
groupName? | string | ユーザ抽出条件のグループ名 |
option | object | 無効ユーザを含めるか指定 |
option詳細
名前 | 型 | 説明 |
---|---|---|
disabled | boolean | true: 無効ユーザを含める false: 無効ユーザを含めない デフォルトはfalse |
戻り値
型 | 説明 |
---|---|
Promise<User[]> | 条件に一致するユーザリスト |
オブジェクト | プロパティ | 型 | 説明 |
---|---|---|---|
User | userId | string | ユーザID (GUID) |
string | Eメール | ||
name | string | ユーザ名 | |
custom_01 | string | カスタム属性1 | |
custom_02 | string | カスタム属性2 | |
custom_03 | string | カスタム属性3 | |
custom_04 | string | カスタム属性4 | |
custom_05 | string | カスタム属性5 | |
custom_06 | string | カスタム属性6 | |
custom_07 | string | カスタム属性7 | |
custom_08 | string | カスタム属性8 | |
custom_09 | string | カスタム属性9 | |
custom_10 | string | カスタム属性10 | |
enabled | boolean | 有効/無効 | |
created | string | 作成日時 | |
updated | string | 更新日時 | |
status | string | ユーザのステータス |
サンプル
try { const users = await $fn.getUsers('group1',{disabled:true});} catch (err) { console.log("Error", err)}
$fn.link(url)
URL先を新規タブに表示する関数です。
引数
名前 | 型 | 説明 |
---|---|---|
url | string | Web サイトの URL |
戻り値
なし
サンプル
$fn.link(‘https://google.com/’);
$fn.listUsersByEmail(email,option)
Emailによる前方一致検索をし、ユーザマネージャに存在するユーザを取得します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
string | 検索文字列 | |
option | object | 無効ユーザを含めるか指定 |
option詳細
名前 | 型 | 説明 |
---|---|---|
disabled | boolean | true: 無効ユーザを含める false: 無効ユーザを含めない デフォルトはfalse |
戻り値
型 | 説明 |
---|---|
Promise<User[]> | 条件に一致するユーザリスト |
オブジェクト | プロパティ | 型 | 説明 |
---|---|---|---|
User | userId | string | ユーザID (GUID) |
string | Eメール | ||
name | string | ユーザ名 | |
custom_01 | string | カスタム属性1 | |
custom_02 | string | カスタム属性2 | |
custom_03 | string | カスタム属性3 | |
custom_04 | string | カスタム属性4 | |
custom_05 | string | カスタム属性5 | |
custom_06 | string | カスタム属性6 | |
custom_07 | string | カスタム属性7 | |
custom_08 | string | カスタム属性8 | |
custom_09 | string | カスタム属性9 | |
custom_10 | string | カスタム属性10 | |
enabled | boolean | 有効/無効 | |
created | string | 作成日時 | |
updated | string | 更新日時 | |
status | string | ユーザのステータス |
サンプル
try { const email = $ui.searchKey.value; // テーブルカラム「userId」「email」「name」があるテーブルに検索結果を表示 $ui.userList.value = await $fn.listUsersByEmail(email,{disabled:true});} catch(err) { console.log("Error", err);}
$fn.listUsersByName(name,option)
ユーザ名による前方一致検索をし、ユーザマネージャに存在するユーザを取得します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
name | String | 検索文字列 |
option | object | 無効ユーザを含めるか指定 |
option詳細
名前 | 型 | 説明 |
---|---|---|
disabled | boolean | true: 無効ユーザを含める false: 無効ユーザを含めない デフォルトはfalse |
戻り値
型 | 説明 |
---|---|
Promise<User[]> | 条件に一致するユーザリスト |
オブジェク | プロパティ | 型 | 説明 |
---|---|---|---|
User | userId | string | ユーザID (GUID) |
string | Eメール | ||
name | string | ユーザ名 | |
custom_01 | string | カスタム属性1 | |
custom_02 | string | カスタム属性2 | |
custom_03 | string | カスタム属性3 | |
custom_04 | string | カスタム属性4 | |
custom_05 | string | カスタム属性5 | |
custom_06 | string | カスタム属性6 | |
custom_07 | string | カスタム属性7 | |
custom_08 | string | カスタム属性8 | |
custom_09 | string | カスタム属性9 | |
custom_10 | string | カスタム属性10 | |
enabled | boolean | 有効/無効 | |
created | string | 作成日時 | |
updated | string | 更新日時 | |
status | string | ユーザのステータス |
サンプル
try { const name = $ui.searchKey.value; // テーブルカラム「userId」「email」「name」があるテーブルに検索結果を表示 $ui.userList.value = await $fn.listUsersByName(name,{disabled:true});} catch(err) { console.log("Error", err);}
$fn.message(parameters)
スナックバーコンポーネントにより、スクリーンにメッセージを表示します。
引数
名前 | 型 | 説明 |
---|---|---|
parameters | object | メッセージ内容を示すオブジェクト |
parameters詳細
プロパティ | 型 | 説明 |
---|---|---|
message | string | 表示するメッセージ文字列 |
close | boolean | メッセージをクローズするボタン |
autoHideDuration | number | 自動クローズまでの時間 (ミリ秒) |
severity | string | アラート表示の指定 |
position | string | 表示位置の指定 |
transitionDuration | number | スナックバーの表示とフェードアウトの時間 (ミリ秒) |
戻り値
なし
サンプル
$fn.message( { message: "Hello world.", close: false, autoHideDuration: 1000, severity: "info", transitionDuration: 300, } );
$fn.nextUI(uiCode)
スクリーンを別のUIに遷移させる関数です。
引数
名前 | 型 | 説明 |
---|---|---|
uiCode | string | 遷移先 UI の ID |
戻り値
なし
サンプル
$fn.nextUI(‘UI01’);
$fn.putFile(path, parameters)
指定パスへファイルを保存します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
path | string | 保存するファイルのパス |
parameters | object | data: Buffer | Unit8Array | string をプロパティに持つオブジェクト |
戻り値
なし
サンプル
try { const obj = await $fn.getFile("/note.dat"); await $fn.putFile('filePath', obj); } catch (err) { console.log("Error", err); }
$fn.removeUsers(param)
アプリケーションの認可グループから登録しているユーザを除外します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
param | object | グループ名と除外するユーザ情報 |
param詳細
プロパティ | 型 | 説明 |
---|---|---|
groupName | string | グループ名 |
emails | array of string | グループから除外するユーザのメールアドレス配列 |
戻り値
なし
サンプル
try { /* CSV の内容 * --------------------------- * "email" * "user01@test.co.jp" * "user02@test.co.jp" * --------------------------- */ const file = await $fn.getFile('/removeUsers.csv'); const buffer = file.data; const addUsers = $fn.csvToObject(buffer); const emails = addUsers.map(function (item) { return item['email']; }); // 認可グループ「Group01」からユーザ除外 await $fn.removeUsers({ groupName: "Group01", emails: emails });} catch(err) { console.log("Error", err);}
$fn.resetPassword(param)
アプリケーションの認証ユーザのパスワードをリセットします。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
param | object | パスワードリセットするユーザの情報 |
param詳細
プロパティ | 型 | 説明 |
---|---|---|
string | Eメール | |
password | string | 一時パスワード |
戻り値
型 | 説明 |
---|---|
Promise<User> | パスワードリセットしたユーザ情報 |
オブジェクト | プロパティ | 型 | 説明 |
---|---|---|---|
User | userId | string | ユーザID (GUID) |
string | Eメール | ||
name | string | 名前 | |
custom_01 | string | カスタム属性1 | |
custom_02 | string | カスタム属性2 | |
custom_03 | string | カスタム属性3 | |
custom_04 | string | カスタム属性4 | |
custom_05 | string | カスタム属性5 | |
custom_06 | string | カスタム属性6 | |
custom_07 | string | カスタム属性7 | |
custom_08 | string | カスタム属性8 | |
custom_09 | string | カスタム属性9 | |
custom_10 | string | カスタム属性10 | |
enabled | boolean | 有効/無効 | |
created | string | 作成日時 | |
updated | string | 更新日時 | |
status | string | ユーザのステータス |
サンプル
try { /* CSV の内容 * ------------------------------------ * "email","password" * "user01@test.co.jp","Password@01" * "user02@test.co.jp","Password@02" * ------------------------------------ */ const file = await $fn.getFile('/resetPassword.csv'); const buffer = file.data; const resetPWInfos = $fn.csvToObject(buffer); // リセットパスワード for (let resetPWInfo of resetPWInfos) { await $fn.resetPassword(resetPWInfo); }} catch(err) { console.log("Error", err);}
$fn.sendMail(param)
メールを送信します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
param | object | メール送信内容を示すパラメータオブジェクト |
param 詳細
プロパティ | 型 | 説明 |
---|---|---|
to | string array | TO アドレス (複数) |
cc | string array | CC アドレス (複数) |
bcc | string array | BCC アドレス (複数) |
fromAddress | string | Fromアドレス |
fromName | string | From 表示名 |
subject | string | サブジェクト |
text | string | 本文 |
encoding | boolean | true: fromNameをBase64エンコーディングする false: fromNameをBase64エンコーディングしない デフォルトはfalse |
実行環境 | fromAddress | fromName | 送信元の表示形式 |
---|---|---|---|
フリー実行環境 | -(設定不可) | -(設定不可) | no-reply@webperformer.jp |
プレミアム実行環境 | 指定あり | 指定なし | 設定したメールアドレス |
プレミアム実行環境 | 指定なし | 指定あり | 設定した表示名 no-reply@webperformer.jp |
プレミアム実行環境 | 指定あり | 指定あり | 設定した表示名 <設定したメールアドレス> |
戻り値
なし
サンプル
try { let toArray=["user01@test.co.jp"]; let textValue = $ui.text.value; let subjectValue = $ui.subject.value; const params = { to: toArray, text: textValue, subject: subjectValue }; await $fn.sendMail(params); } catch(err) { console.log("Error", err); }
$fn.setLanguage(language)
表示言語を変更します。
引数
名前 | 型 | 説明 |
---|---|---|
language | string | [default | en | ja] のいずれかの値を設定 |
戻り値
なし
サンプル
$fn.setLanguage(‘en’);
$fn.signOut()
サインアウトします。
引数
なし
戻り値
なし
サンプル
$fn.signOut();
$fn.updateUser(param)
アプリケーションの認証ユーザを更新します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
param | object | 更新するユーザ情報 |
param詳細
プロパティ | 型 | 説明 |
---|---|---|
originalEmail | string | Eメール(更新前) |
string | Eメール(更新後) | |
name | string | 名前 |
enabled | boolean | true:有効 false:無効 デフォルトはtrue |
custom_01 | string | カスタム属性1 |
custom_02 | string | カスタム属性2 |
custom_03 | string | カスタム属性3 |
custom_04 | string | カスタム属性4 |
custom_05 | string | カスタム属性5 |
custom_06 | string | カスタム属性6 |
custom_07 | string | カスタム属性7 |
custom_08 | string | カスタム属性8 |
custom_09 | string | カスタム属性9 |
custom_10 | string | カスタム属性10 |
戻り値
型 | 説明 |
---|---|
Promise<User> | 更新したユーザ情報 |
オブジェクト | プロパティ | 型 | 説明 |
---|---|---|---|
User | userId | string | ユーザID (GUID) |
string | Eメール | ||
name | string | 名前 | |
custom_01 | string | カスタム属性1 | |
custom_02 | string | カスタム属性2 | |
custom_03 | string | カスタム属性3 | |
custom_04 | string | カスタム属性4 | |
custom_05 | string | カスタム属性5 | |
custom_06 | string | カスタム属性6 | |
custom_07 | string | カスタム属性7 | |
custom_08 | string | カスタム属性8 | |
custom_09 | string | カスタム属性9 | |
custom_10 | string | カスタム属性10 | |
enabled | boolean | 有効/無効 | |
created | string | 作成日時 | |
updated | string | 更新日時 | |
status | string | ユーザのステータス |
サンプル
try { /* CSV の内容 * --------------------------------------------------------- * "originalEmail","email","name","enabled" * "user01@test.co.jp","user01@test.co.jp","User01",ture * "user02@test.co.jp","user02@test.co.jp","User02",false * --------------------------------------------------------- */ const file = await $fn.getFile('/updateUserInfo.csv'); const buffer = file.data; const userInfos = $fn.csvToObject(buffer); for (let userInfo of userInfos) { let data = {}; data = { originalEmail: userInfo['originalEmail'], email: userInfo['email'], name: userInfo['name'], enabled: JSON.parse(userInfo['enabled']) }; // ユーザ更新 const result = await $fn.updateUser(data); }} catch(err) { console.log("Error", err);}