Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// will assign a stopwatch to a task.... returns The result
- /// </summary>
- /// <param name="clarizen"></param>
- /// <param name="User"></param>
- /// <param name="Task"></param>
- /// <returns></returns>
- public static Result addStopWatchToTask(Clarizen clarizen, String UserId, Task Task)
- {
- //task entity
- GenericEntity task = new GenericEntity();
- task.Id = new EntityId() { TypeName = "Task", Value = Task.Id };
- //stopwatch entity link
- GenericEntity link = new GenericEntity();
- link.Id = new EntityId() { TypeName = "Stopwatch" };
- //get the work item field in the task item
- FieldValue workItemField = new FieldValue() { FieldName = "WorkItem", Value = task.Id };
- //add user to the rescource field (stop watch rescource is called user)
- FieldValue stopWatchField = new FieldValue() { FieldName = "User", Value = new EntityId() { TypeName = "User", Value = UserId } };
- //link that shit
- link.Values = new FieldValue[] { workItemField, stopWatchField };
- CreateMessage createCustomerLinkMessage = new CreateMessage() { Entity = link };
- Result[] result = clarizen.Execute(new BaseMessage[] { createCustomerLinkMessage });
- return result[0];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement