Developer Q&A
How to create WorkOrderCost entry?
I'm trying to construct a query to create a new WorkOrderCost line item for an employee at a given rate:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:int="http://corrigo.com/integration/">
<soap:Header>
<int:CorrigoNetOptions>
<int:ImposeConcurrencyId>false</int:ImposeConcurrencyId>
<int:UpdateLastModified>false</int:UpdateLastModified>
<int:CanDeleteMissingEntity>false</int:CanDeleteMissingEntity>
<int:LockOnDataRetrieval>Default</int:LockOnDataRetrieval>
</int:CorrigoNetOptions>
</soap:Header>
<soap:Body>
<int:Execute>
<int:commandRequest xsi:type="int:UpdateCommand" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<int:Entity xsi:type="int:WorkOrder">
<int:Id>120760</int:Id>
<int:WorkOrderCost>
<int:Id>120760</int:Id>
<int:Items>
<int:FinancialItem>
<int:Amount>
<int:CurrencyTypeId>USD</int:CurrencyTypeId>
1.0000
</int:Amount>
<int:CostCategoryId>Labor</int:CostCategoryId>
<int:Rate>
<int:CurrencyTypeId>USD</int:CurrencyTypeId>
<int:Value>75.0000</int:Value>
</int:Rate>
<int:Employee>
3661
</int:Employee>
<int:LaborCode>
<int:Id>9</int:Id>
</int:LaborCode>
</int:FinancialItem>
</int:Items>
</int:WorkOrderCost>
</int:Entity>
<int:PropertySet xsi:type="int:PropertySet">
<int:Properties>
<int:string>Id</int:string>
<int:string>WorkOrderCost.Id</int:string>
<int:string>WorkOrderCost.Items.Id</int:string>
<int:string>WorkOrderCost.Items.LaborCode.Id</int:string>
</int:Properties>
</int:PropertySet>
</int:commandRequest>
</int:Execute>
</soap:Body>
</soap:Envelope>
However I'm getting
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
0
Object reference not set to an instance of an object.
System.NullReferenceException
WorkOrder
120760
0
</soap:Body>
</soap:Envelope>
Any insight as to what I'm missing?
Raul