Questetra Get Membership Mail Address Belong To Org
Get Questetra Membership Mail Address Belong To Org
Configs
  • A1: INPUT Qgroup Id (Org Id).#{EL}
  • A2: Select ORG DATA
  • B1: Select STRING DATA for Quser Emails: separating new line
  • B2: Select STRING DATA for Quser Emails: separating comma
Script (click to open)


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

  //// == Config Retrieving / 工程コンフィグの参照 ==
  //// == Data Retrieving / ワークフローデータの参照 ==
  //// == Validation / 入力チェック
  const conf_qgroupId = configs.get( "conf_QgroupId" );
  const conf_qgroup = configs.getObject( "conf_Qgroup" );
  const conf_Qusers_separating_newline = configs.getObject( "conf_Qusers_separating_newline" );
  const conf_Qusers_separating_comma = configs.getObject( "conf_Qusers_separating_comma" );

  //// == Calculating / 演算 ==
  let qGroup = null;
  if ( conf_qgroupId !== null && conf_qgroupId !== "") {
      qGroup = qgroupDao.findById( new java.lang.Long(conf_qgroupId) );
  } else if (conf_qgroup !== null) {
      qGroup = engine.findData( conf_qgroup );
  }
  if (qGroup === null){
      engine.log("No organization specified.");
      return;
  }
  const qUsers = quserDao.findByQgroup( qGroup );

  let qUsersList = "";
  let qUsersListByComma = "";

  for(var i=0; i < qUsers.size(); i++){
      qUsersList += qUsers.get(i).getEmail() + "\n";
      qUsersListByComma += qUsers.get(i).getEmail() + ",";
  }
  qUsersList = qUsersList.replace(/\n$/,"");
  qUsersListByComma = qUsersListByComma.replace(/\,$/,"");
  engine.log("qUsersList: " + qUsersList);
  engine.log("qUsersListByComma:" + qUsersListByComma + "");

  //// == Data Updating / ワークフローデータへの代入 ==
  if ( conf_Qusers_separating_newline !== null ){
    engine.setData( conf_Qusers_separating_newline, new java.lang.String(qUsersList) );
  }
  if ( conf_Qusers_separating_comma !== null ){
    engine.setData( conf_Qusers_separating_comma, new java.lang.String(qUsersListByComma) );
  }
} //////// END "main()" /////////////////////////////////////////////////////////////////

Download

2022-05-31 (C) Questetra, Inc. (MIT License)
https://support.questetra.com/addons/questetra-membership-get-mail-address-belong-to-org-2022/
The Addon-import feature is available with Professional edition.
Freely modifiable JavaScript (ECMAScript) code. No warranty of any kind.

Notes

  • If both A1 and A2 are set, A1 takes precedence
  • How to get “Qgroup ID”
    • [System Settings] > [Organizations List] > Click target organization name > Check Organization ID
    • Input the Organization ID excluding “g”.

Capture

See also

%d bloggers like this: