Task Manager - Delete comments

Lindsay
New Contributor III

Is there a way to delete comments in Task Manager? I have tried testing this out and even when the task is not started or completed, it does not allow me to delete a comment. This seems strange because there is a minus button there but it is grayed out. Am I missing a setting somewhere? Thank you! 

5 REPLIES 5

mjohnson
New Contributor III

Is the box to Edit Commentary in the Global Options checked?  Also, it might be the case that whomever posted the commentary is the only one that can edit.

Lindsay
New Contributor III

I don't see that option, I wonder if it is because we are on an older version of Task Manager. We are on PV 440, SV 202. Might just be that it's time for us to upgrade 🙂 

NaeemPathan
New Contributor II

I do not think you can, I have just recently installed the latest version (PV 660) and even with 'Edit Commentary' ticked, does not allow you to remove the comment (even as the same user/admin user).

I plan to raise this with OS as I have other comments too.

 

NaeemPathan_0-1680194554186.png

 

t_kaplanis
New Contributor II

Hello Everyone,

I know a way to delete comments in Task Manager. However, it is not done through the Task Manager User Interface.

When users input comments within Task Manager they are saved in the backend table "XFW_UTM_TaskCommentary". This table saves comments by WFTimeName and assigns a CommentaryID to each comment. The contents of this table can be seen through the "Database" page. I recommend viewing the table before executing any code.

You can remove the comments by executing a SQL statement through an extensibility business rule.

  • Use the DELETE SQL Statement to remove CERTAIN rows from the table based on conditions you change in the statement. I think being specific and using [WFTimeName] and [CommentaryID] as the conditions for the removal of comments is best.

In the code below, you can see that I use [WFTimeName] and [CommentaryID] in the WHERE clause for the DELETE statement to delete specific comments from the table thus removing them from Task Manager.

  • Use the TRUCATE SQL Statement to remove ALL table contents, but keep the table structure. (CAUTION - Removes EVERYTHING for comments in Task Manager)

Uncomment and edit which statement you would like to use between the "----"s in the code. You are able to run this code directly from the business rule window once you have the correct statement you want to execute.

DISCLAIMER: Use this code at your own risk. Using this code can remove ALL comments used in Task Manager including history. I assume no responsibility or liability for any errors or omissions within the content of this post.

Imports System
Imports System.Data
Imports System.Data.Common
Imports System.IO
Imports System.Collections.Generic
Imports System.Globalization
Imports System.Linq
Imports Microsoft.VisualBasic
Imports System.Windows.Forms
Imports OneStream.Shared.Common
Imports OneStream.Shared.Wcf
Imports OneStream.Shared.Engine
Imports OneStream.Shared.Database
Imports OneStream.Stage.Engine
Imports OneStream.Stage.Database
Imports OneStream.Finance.Engine
Imports OneStream.Finance.Database

Namespace OneStream.BusinessRule.Extender.ResetUTMComments
	Public Class MainClass
		Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As ExtenderArgs) As Object
			Try
				
				 Using dbconn As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)	           

						'Uncomment below lines to remove CERTAIN rows based on a CONDITION in the XFW_UTM_TaskCommentary table.
						'---------------------------------------------------------------------------------------------
'						Dim sqlDeleteStmt As New Text.StringBuilder
'							sqlDeleteStmt.AppendLine($"DELETE")
'							sqlDeleteStmt.AppendLine($"From XFW_UTM_TaskCommentary")
'							sqlDeleteStmt.AppendLine($"Where [WFTimeName] = '2023M3' AND [CommentaryID] = 'd44444fe-61b9-4b19-96bc-2c575df5b33f'")
'	                    Dim dtT = BRApi.Database.ExecuteSql(dbconn, sqlDeleteStmt.ToString, True)
						'---------------------------------------------------------------------------------------------		

						
						'Uncomment below two lines to remove all rows in the XFW_UTM_TaskCommentary table.
						'---------------------------------------------------------------------------------------------
'						Dim sqlTruncStmt = $"TRUNCATE TABLE XFW_UTM_TaskCommentary"
'	                    Dim dtT = BRApi.Database.ExecuteSql(dbconn, sqlTruncStmt, True)
						'---------------------------------------------------------------------------------------------
						
	             End Using
				 
				Return Nothing
			Catch ex As Exception
				Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
			End Try
		End Function
	End Class
End Namespace

 

 

Lindsay
New Contributor III

Thanks for the information and code! I'm not sure we are at a point where we have to delete the old comments (we just leave them out there and make a new comment saying that it is no longer relevant), but this is good to know! Hopefully in a future release it will be available in the Task Manager user interface!