Open Chat, Post

Open Chat, Post
Open Chat, Post

Posts to Open Chat (Enterprise Social in Questetra BPMS) with PID like “#p123” from the workflow engine standpoint. Posts will only be displayed on the participant timelines. Note that any BPMS user can search in their timeline, unlike Workflow Data.

2019-12-18 (C) Questetra, Inc. (MIT License)
https://support.questetra.com/addons/open-chat-post/

Configs
  • A: Select STRING DATA for Post Text *
  • B: Select FILES DATA for Attachment
  • C: Set OrgID to display on member timelines (eg g99->”99″) #{EL}
Script
// (c) 2019, Questetra, Inc. (the MIT License)
// Notes:
// If Organization ID is configured, the posts will be displayed on the member timelines.
//
// Notes(ja):
// 組織IDをセットしておくと、メンバーのタイムラインにも表示されるようになります


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

//// == Config Retrieving / 工程コンフィグの参照 ==
const dataIdA = configs.get( "conf_DataIdA" ) + "";  // config required
const dataIdB = configs.get( "conf_DataIdB" ) + "";  // config not required
const orgId   = configs.get( "conf_OrgId" ) + "";    // config not required
engine.log( " AutomatedTask Config: Organization ID: " + orgId );


//// == Data Retrieving / ワークフローデータの参照 ==
let strPostText = "";
if( engine.findDataByNumber( dataIdA ) !== null ){
  strPostText = engine.findDataByNumber( dataIdA ) + "";
}
let arrFiles = "noFile";
let numFilesSize = 0;
if( dataIdB !== "" ){ // if configured
  arrFiles = engine.findDataByNumber( dataIdB ); // java.util.ArrayList
  if( arrFiles !== null ){
    numFilesSize = arrFiles.size() - 0; // Java Int to Javascript number
  }else{
    engine.log( " AutomatedTask FilesWarning:" +
                " Files not attached" );
  }
}


//// == Calculating / 演算 ==
// prepare OpenChat Message
// com.questetra.bpms.core.event.scripttask.FeedServiceWrapper
let chatMsg = feedService.begin(); // returns FeedMessageWrapper
    chatMsg = chatMsg.setMessage( strPostText );
if( numFilesSize !== 0 ){
  for( let i = 0; i < numFilesSize; i++ ){
    // com.questetra.bpms.core.event.scripttask.QfileView
    engine.log( " AutomatedTask Files:" +
                " File Name: " + arrFiles.get(i).getName() );
    engine.log( " AutomatedTask Files:" +
                " File Length: " + arrFiles.get(i).getLength() );
    engine.log( " AutomatedTask Files:" +
                " File ContentType: " + arrFiles.get(i).getContentType() );
    chatMsg = chatMsg.attachFile( arrFiles.get(i) );
  }
}
if( orgId !== "" ){
    // com.questetra.bpms.core.event.scripttask.QgroupDaoWrapper
    chatMsg = chatMsg.setShareQgroup( qgroupDao.findById( orgId ) );
}

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


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


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

Download

Capture

Posts to Open Chat (Enterprise Social in Questetra BPMS) with PID like "#p123" from the workflow engine standpoint. Posts will only be displayed on the participant timelines. Note that any BPMS user can search in their timeline, unlike Workflow Data.

Notes

  1. If Organization ID is configured, the posts will be displayed on the member timelines.
  2. There is no function to delete a post from the standpoint of a workflow engine. (As of 2019)

See also

Leave a Reply

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

%d bloggers like this: