AnsweredAssumed Answered

Forum - Programatically reply to a discussion/forum message

Question asked by caiosm1005 on Aug 23, 2017
Latest reply on Aug 26, 2017 by caiosm1005

Hello,

 

I am trying to programatically reply to a message in a discussion forum.

 

The message must be in pending moderation status (MODQUEUE). I would like to append a response to said message.

 

Here's the code I am currently using:

 

// Create response
Message responseMessage = new Message();
responseMessage.setBody( "Hello, world!" );

// Add response to the original message and save
messageToReplyTo.appendResponse( responseMessage );
this._messageManager.save( messageToReplyTo );


 

However, once I run this snippet, nothing happens.

 

Could anyone shed some light on this?

 

Any B2 recommendations that programatically adds a response to a forum message would be of great help (I would take a look into its source code).

 

Thank you.

Outcomes