souldown

link rescourse and user

Apr 17th, 2014
209
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   public static bool LinkUserToTask(Clarizen clarizen,  User User,Task Task)
  2.         {
  3.             GenericEntity task = new GenericEntity();
  4.             task.Id = new EntityId() { TypeName = "Task", Value = Task.Id }; //Dictionary is either task or
  5.  
  6.             GenericEntity link = new GenericEntity();
  7.             link.Id = new EntityId() { TypeName = "ResourceLink" };
  8.             FieldValue rescourceField = new FieldValue() { FieldName = "WorkItem", Value = task.Id };
  9.             FieldValue userField = new FieldValue() { FieldName = "Resource", Value = new EntityId() { TypeName = "User", Value = User.Id } };
  10.             link.Values = new FieldValue[] { rescourceField, userField };
  11.             CreateMessage createCustomerLinkMessage = new CreateMessage() { Entity = link };
  12.             Result[] result = clarizen.Execute(new BaseMessage[] { createCustomerLinkMessage });
  13.             Console.WriteLine(result[0].ToString());
  14.             return false;
  15.  
  16.         }
RAW Paste Data