Discussions

Ask a Question
Back to All

How can I update a WorkOrder.Assignment?

How can update a work orders assignment? I need to update the work orders assignment to a different employeeId.

I've tried using the WOAssignment command from here

https://github.com/Corrigo/9x.WebServices.Examples/blob/master/9x.WebServices.WorkOrders/Operations/Assignment/Update.cs

var entity = new WoAssignment
{
  Id = workOrder.Assignments[0].Id,
  EmployeeId = Corrigo.WksFacilitiesUserId,
};

I receive the following error.

modifications must be performed in parent's context; parent ID #213424

I tried updating the entire work order

var command = new UpdateCommand
{
  Entity = workOrder,
  PropertySet = new PropertySet { Properties = ["Assignments.EmployeeId"] },
};

I receive the following error:

WorkOrder.Assignments property can't be updated.

Do I need to delete wo assignment and then add a new one?