Open Chat, Post
Posts the text to OpenChat in the Workflow Platform. Since the ProcessID hashtag (topic) like “#p123” is automatically added, it will be displayed on the timeline of the process participants. Note that all users can browse with searching.
Configs
  • A1: Set Text to Post#{EL}
  • A2: Select FILES DATA to Attach
  • A3: Set URLs to Link (in each line if multiple)#{EL}
  • B1: To display to member timeline, set Org ID (eg “99” for g99)#{EL}
Script (click to open)


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

//// == Config Retrieving / 工程コンフィグの参照 ==
const strText           = configs.get      ( "StrConfA1" );    // NotRequired
const filesPocketAttach = configs.getObject( "SelectConfA2" ); // NotRequired
const strUrls           = configs.get      ( "StrConfA3" );    // NotRequired
const strOrgId          = configs.get      ( "StrConfB1" );    // NotRequired


//// == Data Retrieving / ワークフローデータの参照 ==
let filesAttach = null;
if( filesPocketAttach !== null ){
    filesAttach = engine.findData( filesPocketAttach );
    // java.util.ArrayList
    // List<com.questetra.bpms.core.event.scripttask.QfileView>
}
if( strText === "" && filesAttach === null && strUrls === "" ){
  throw new Error( "\n AutomatedTask ConfigError:" +
                   " No data in Config {A1} {A2} {A3} \n" );
}


//// == Calculating / 演算 ==
/// prepare OpenChat Message
let chatMsg = feedService.begin(); // FeedServiceWrapper
  // com.questetra.bpms.core.event.scripttask.FeedServiceWrapper

if( strText !== "" ){
    chatMsg = chatMsg.setMessage( strText );
}
if( filesAttach !== null ){
  let numFilesSize = filesAttach.size() - 0;
  for( let i = 0; i < numFilesSize; i++ ){
    chatMsg = chatMsg.attachFile( filesAttach.get(i) );
    engine.log(
      " AutomatedTask AttachedFile:" +
      " '" + filesAttach.get(i).getName()        + "'"      +
      " (" + filesAttach.get(i).getLength()      + " byte)" +
      " '" + filesAttach.get(i).getContentType() + "'"
    );
  }
}
if( strUrls !== "" ){
  const arrUrls = strUrls.split("\n");
  for( let i = 0; i < arrUrls.length; i++ ){
    if( arrUrls[i] !== "" ){
      chatMsg = chatMsg.attachLink( arrUrls[i] );
      engine.log(
        " AutomatedTask AttachedLink:" +
        " '" + arrUrls[i] + "'"
      );
    }
  }
}
if( strOrgId !== "" ){
    chatMsg = chatMsg.setShareQgroup( qgroupDao.findById( strOrgId - 0 ) );
    // com.questetra.bpms.core.event.scripttask.QgroupDaoWrapper
}

/// post Message to OpenChat
engine.log( " AutomatedTask OpenChat: Post" );
const numPostResult = chatMsg.post() - 0; // Java Long to Javascript number
engine.log( " AutomatedTask OpenChat Message ID: "  + numPostResult );


//// == Data Updating / ワークフローデータへの代入 ==
// (nothing)


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

/*
Notes:
- When the process reaches the automated step, the text is automatically posted.
    - Posted by the special icon "Questetra" who cannot be followed.
- The Process ID (e.g., "#p123") is automatically added.
    - That is, it is displayed on the timeline of Users who participated in the process.
    - https://questetra.zendesk.com/hc/en-us/articles/360002242232-M120
        - "M120: Mentioning Just Like Twitter"
- It is also possible to specify the shared destination Organization (scope).
    - That is, every time a process arrives, it will be displayed on the timeline of all users in the scope.
    - Set "Organization ID" in the B1 config of the Auto-Step.
- To dynamically control the timelines to be displayed, add a hashtag to the text.
    - The user who should be displayed should follow the hashtag (topic) in advance.
- Posted text may be viewed by all users of the workflow platform.
    - Posts in Open Chat can be searched and viewed by all users.
    - https://questetra.zendesk.com/hc/en-us/articles/360002242212-M119
        - "M119: Enterprise Social Networking Open Company-Wide"

APPENDIX-en:
- No need to set authentication or authorization (OAuth2) when modeling.
    - There is no way to post from the standpoint of a specific user.
    - Posted with the icon of the special contributor "Questetra" (cannot be followed).
- There is no function to delete posts by special contributors (As of June 2022)


Notes-ja:
- 案件が自動工程に到達した際に、「投稿文」が自動投稿されます。 OpenChat Post
    - 特別な投稿者「Questetra」(フォローできません)のアイコンで投稿されます。
- 案件のID(プロセスID/例: "#p123" )が自動的に付与されます。
    - すなわち、「その案件に関与したユーザ」のタイムラインに表示されます。
    - https://questetra.zendesk.com/hc/ja/articles/360002242232-M120
        - 「M120: 特に伝えたい相手を指名してつぶやく(メンション)」
- 共有先組織(スコープ)を指定して運用することも可能です。
    - すなわち、案件が到達する度に、スコープ内全ユーザのタイムラインに表示されます。
    - 自動工程のコンフィグ画面 B1 で、「組織ID」をセットします。
- 表示タイムラインを動的にコントロールしたい場合、「投稿文」にハッシュタグを追加します。
    - 表示されるべきユーザは、予め当該ハッシュタグ(トピック)をフォローしておきます。
- 投稿文は、ワークフロー基盤の全ユーザに閲覧される可能性があります。
    - オープンチャットの投稿文は、全てのユーザが検索閲覧できます。
    - https://questetra.zendesk.com/hc/ja/articles/360002242212-M119
        - 「M119: 全社オープンなコミュニケーションを行う(他ユーザや業務トピックをフォローする)」

APPENDIX-ja:
- モデリング時に認証情報や認可(OAuth2)を設定する必要はありません。
    - 特定ユーザの立場で投稿する方法はありません。
    - 特別な投稿者「Questetra」(フォローできません)のアイコンで投稿されます。
- 特別な投稿者の投稿(ワークフローエンジンの立場からの投稿)を削除する機能はありません。(2022年6月現在)
*/

Download

2022-06-26 (C) Questetra, Inc. (MIT License)
https://support.questetra.com/addons/open-chat-post-2022/
The Addon-import feature is available with Professional edition.
How to add on: (M415: Adding an Auto-Step to be Used in a Business Process Definition)
Freely modifiable JavaScript (ECMAScript) code. No warranty of any kind.

Notes

  • When the process reaches the automated step, the text is automatically posted.
    • Posted by the special icon “Questetra” who cannot be followed.
  • The Process ID (e.g., “#p123”) is automatically added.
  • It is also possible to specify the shared destination Organization (scope).
    • That is, every time a process arrives, it will be displayed on the timeline of all users in the scope.
    • Set “Organization ID” in the B1 config of the Auto-Step.
  • To dynamically control the timelines to be displayed, add a hashtag to the text.
    • The user who should be displayed should follow the hashtag (topic) in advance.
  • Posted text may be viewed by all users of the workflow platform.

Capture

Posts the text to OpenChat in the Workflow Platform. Since the ProcessID hashtag (topic) like "#p123" is automatically added, it will be displayed on the timeline of the process participants. Note that all users can browse with searching.

Appendix

  • No need to set authentication or authorization (OAuth2) when modeling.
    • There is no way to post from the standpoint of a specific user.
    • Posted with the icon of the special contributor “Questetra” (cannot be followed).
  • There is no function to delete posts by special contributors (As of June 2022)

See also

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: