Monday, December 17, 2007

Automatically complete a task via a callout

Code:

public void CompleteTask(Guid taskId)
{
SetStateTaskRequest tr = new SetStateTaskRequest();

tr.EntityId = taskId;
tr.TaskState = new TaskState();
tr.TaskState = TaskState.Completed;
tr.TaskStatus = -1 ; // Set this field to -1 to have the platform set the appropriate value

service.Execute(tr);
}


Unfortunately for some unknown reason; completing the task using the above code will cause the workflow (a Sales Process workflow was tested) to end.

Wednesday, December 12, 2007

Prevent a form from being saved

Javascript - OnSaved() event



Actually it's:

event.returnValue = false;
return false;

What aborts the Save operation.
.