PublicAPI.Projects.ProjectTaskBase.CompleteTask ELMA API Documentation
Complete the task
 
 
Syntax

public void CompleteTask(
	ProjectTaskBase projectTask,
	CommentActionModel model,
	bool alertCoexecuters
)

Parameters

projectTask
Type: ProjectTaskBase
Project task to complete. Object. Access path: PublicAPI.Projects.ProjectTaskBase
model
Type: CommentActionModel
Model for the action with comments and attachments
alertCoexecuters
Type: System Boolean
Notify coexecutors
Examples

//load the required data 
var projectTask = PublicAPI.Projects.Tasks.LoadOrNull(3); //load the project task by ID 

//Create a comment 
var comment = PublicAPI.Portal.Objects.Common.Comment.Create();
comment.Text = "Comment";
comment.CreationAuthor = PublicAPI.Portal.Security.User.GetCurrentUser();
comment.CreationDate = DateTime.Now;
comment.Save();

//Create an attachment 
var attach = PublicAPI.Portal.Objects.Common.Attachment.Create();
attach.CreationAuthor = PublicAPI.Portal.Security.User.GetCurrentUser();
attach.CreationDate = DateTime.Now;
attach.File = context.File;
attach.Save();

//Create CommentActionModel and fill it in 
var model = InterfaceActivator.Create<ICommentActionModel>();
model.Attachments.Add(attach);
model.Comment = comment;

//Execute a task
PublicAPI.Projects.Tasks.CompleteTask(projectTask, model, false);
See Also