コンバータ: Email文字列 to Quser

コンバータ: Email文字列 to Quser

translate Converter: Email-String to Quser

Email文字列(文字列データ)をユーザ型データに変換します。当該アドレスが、ワークフロー基盤のユーザアドレスとして登録されていなかった場合、エラー終了します(ユーザ型データ項目の値は更新されません)。なお、複数行文字列やカンマ区切文字列で複数のアドレスが列挙されている場合、先頭から順次判定し、一致するユーザが発見され次第、正常終了します。

Auto Step icon
Configs for this Auto Step
StrConfA
A: Emailアドレスをセットしてください *#{EL}
SelectConfB
B: ユーザ型データ項目を選択してください(更新) *
Script (click to open)
// GraalJS Script (engine type: 2)
// (c) 2023, Questetra, Inc. (the MIT License)

//////// START "main()" /////////////////////////////////////////////////////////////////
main();
function main(){

////// == Config Retrieving / 工程コンフィグの参照 ==
const strEmails      = configs.get       ( "StrConfA" );          /// REQUIRED
const quserPocket    = configs.getObject ( "SelectConfB" );       /// REQUIRED


////// == Data Retrieving / ワークフローデータの参照 ==
// (Nothing. Retrieved via Expression Language in Config Retrieving)


////// == Calculating / 演算 ==
const arrLines  = strEmails.split ( '\n' );
let quserTmp    = null;

iLoop: for ( let i = 0; i < arrLines.length; i++ ) {
  const arrCols = arrLines[i].split ( ',' );
  for ( let j = 0; j < arrCols.length; j++ ) {
    quserTmp = quserDao.findByEmail ( arrCols[j].trim() );
    // https://support.questetra.com/ja/tips/workflow-script-example/#Handle-QUSER-QGROUP-QROLE
    // com.questetra.bpms.core.event.scripttask.QuserView

    if( quserTmp !== null ) {
      engine.log( " AutomatedTask QuserCheck: found at Line:" + i + "_Col:" + j +
                   " [" + quserTmp.getId() + "] " + quserTmp.getName() );
      break iLoop;
    }
  }
}

if( quserTmp === null ){
  throw new Error( "\n AutomatedTask UnexpectedError: " +
                    "None of the addresses matched QUSER. \n" );
}


//// == Data Updating / ワークフローデータへの代入 ==
if( quserPocket !== null ){
  engine.setData ( quserPocket, quserTmp );
}

} //////// END "main()" ////////

/*
Notes:
- If you place this "Automated Step" in the Workflow diagram, the script will be executed every time the process token arrives.
- This "Automated Step" converts a string (Email string) to QUSER data.
     - Match with all users registered in the workflow platform.
     - If there are no matching users, this automated step will result in an error.
         - It is also possible to proceed to the "Error Catch Event" (error boundary event).

APPENDIX:
- Whitespace are automatically removed (trimmed) from both ends of an address string.
- Separate multiple addresses with line breaks or commas.
    - No problem, if both are mixed.
- The format `name-addr` is not supported. (eg "`foo <foo@example.com>`")
    - The input value in the format `addr-spec`. (eg "`foo@example.com`")
    - https://datatracker.ietf.org/doc/html/rfc5321
    - https://datatracker.ietf.org/doc/html/rfc5322
- Older version
    - https://support.questetra.com/addons/converter-emailstr-to-quser-2021/

Notes-ja:
- この[自動工程]をワークフロー図に配置すれば、案件が到達する度に既定のスクリプトが実行されます。
- 文字データ(Email文字列)を、ユーザ型データに変換します。
    - ワークフロー基盤内に登録されている全ユーザと照合します。
    - マッチするユーザがいない場合、この自動工程の処理はエラーとなります。
        - 存在しない場合に[エラー境界イベント]に分岐させることも可能です。

APPENDIX-ja:
- アドレス前後の空白文字は自動的に削除(trim)されます。
- 複数アドレスを列挙する場合、改行もしくはカンマで区切ります。
    - 両方が混在していても構いません。
- 書式 `name-addr` には対応していません。(eg "`foo <foo@example.com>`") 
    - 入力値は、書式 `addr-spec` にて記述してください。(eg "`foo@example.com`") 
    - https://datatracker.ietf.org/doc/html/rfc5321
    - https://datatracker.ietf.org/doc/html/rfc5322
- 旧バージョン
    - https://support.questetra.com/ja/addons/converter-emailstr-to-quser-2021/
*/

Download

warning 自由改変可能な JavaScript (ECMAScript) コードです。いかなる保証もありません。
(アドオン自動工程のインストールは Professional editionでのみ可能です)

Notes

  • この[自動工程]をワークフロー図に配置すれば、案件が到達する度に既定のスクリプトが実行されます。
  • 文字データ(Email文字列)を、ユーザ型データに変換します。
    • ワークフロー基盤内に登録されている全ユーザと照合します。
    • マッチするユーザがいない場合、この自動工程の処理はエラーとなります。
      • 存在しない場合に[エラー境界イベント]に分岐させることも可能です。

Capture

Email文字列(文字列データ)をユーザ型データに変換します。当該アドレスが、ワークフロー基盤のユーザアドレスとして登録されていなかった場合、エラー終了します(ユーザ型データ項目の値は更新されません)。なお、複数行文字列やカンマ区切文字列で複数のアドレスが列挙されている場合、先頭から順次判定し、一致するユーザが発見され次第、正常終了します。

Appendix

See Also

コメントを残す

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください

%d人のブロガーが「いいね」をつけました。