Discussions

Ask a Question
Back to all

How to add a service fee to a WorkOrder?

Hi,

How can we add a service fee to a work order using the API?

We've tried doing a POST of FinancialItem, but received the same error noted on this discussion ("WoCostDetail modifications must be performed in parent's context"): https://developer.corrigo.com/discuss/684343e7dbe7dc0069b73d53.

So instead of that approach, we built a WorkorderCost to perform a PUT against, after adding the new Item, but receive {"ErrorMessage":"{!{Internal Costs}!} are read-only and cannot be modified","ErrorCode":"BUSINESS_LOGIC_ERROR"...}


{
  "Properties" : ["Items.*","*"],
  "Entity" : {
    "Id":  852,
    "WorkOrderId":  852,
    "CurrencyTypeId":  "USD",
    "BillToOption":  {
                         "Id":  1
                     },
    "CostsTotal":  {
                       "CurrencyTypeId":  "USD",
                       "Value":  235.3600
                   },
    "ApStateId":  "None",
    "ApStatusId":  1,
    "JobCode":  "",
    "Contract":  {
                     "Id":  77
                 },
    "AuthorizationCode":  "",
    "CheckNumber":  "",
    "PaymentAmount":  {
                          "CurrencyTypeId":  "USD",
                          "Value":  0.0000
                      },
    "PaymentNotes":  "",
    "GlAccount":  "",
    "Number":  "",
    "VendorInvoiceTotal":  {
                               "CurrencyTypeId":  "USD",
                               "Value":  0.0000
                           },
    "IsPreBilled":  false,
    "ExpensesTotal":  {
                          "CurrencyTypeId":  "USD",
                          "Value":  235.3600
                      },
    "BillingRule":  "NotBilled",
    "TaxStatus":  "None",
    "CustomerNte":  {
                        "CurrencyTypeId":  "USD",
                        "Value":  0.0000
                    },
    "Items":  [
                  {
                      "WoId":  852,
                      "CurrencyTypeId":  "USD",
                      "Comment":  "John Doe - 51110",
                      "Amount":  {
                                     "CurrencyTypeId":  "USD",
                                     "Value":  37.2600
                                 },
                      "CostCategoryId":  "Labor",
                      "Rate":  {
                                   "CurrencyTypeId":  "USD",
                                   "Value":  37.2600
                               },
                      "StartDate":  "2025-06-23T08:00:00",
                      "Duration":  60,
                      "RuleModification":  "None",
                      "Employee":  {
                                       "Id":  1529
                                   },
                      "Quantity":  1.00000,
                      "LaborCode":  {
                                        "Id":  102
                                    },
                      "TypeId":  "Cost",
                      "TaxAmount":  {
                                        "CurrencyTypeId":  "USD",
                                        "Value":  0.0000
                                    },
                      "WithholdingTaxRate":  0.0,
                      "NonBillable":  false,
                      "MerchantName":  "",
                      "ConcurrencyId":  1,
                      "Id":  22
                  },
                  {
                      "WoId":  852,
                      "CurrencyTypeId":  "USD",
                      "Comment":  "John Doe - 51110",
                      "Amount":  {
                                     "CurrencyTypeId":  "USD",
                                     "Value":  0.0000
                                 },
                      "CostCategoryId":  "Labor",
                      "Rate":  {
                                   "CurrencyTypeId":  "USD",
                                   "Value":  37.2600
                               },
                      "StartDate":  "2025-06-23T12:59:00",
                      "Duration":  0,
                      "RuleModification":  "None",
                      "Employee":  {
                                       "Id":  1529
                                   },
                      "Quantity":  0.00000,
                      "LaborCode":  {
                                        "Id":  102
                                    },
                      "TypeId":  "Cost",
                      "TaxAmount":  {
                                        "CurrencyTypeId":  "USD",
                                        "Value":  0.0000
                                    },
                      "WithholdingTaxRate":  0.0,
                      "NonBillable":  false,
                      "MerchantName":  "",
                      "ConcurrencyId":  1,
                      "Id":  23
                  },
                  {
                      "WoId":  852,
                      "CurrencyTypeId":  "USD",
                      "Comment":  "John Doe - 51110",
                      "Amount":  {
                                     "CurrencyTypeId":  "USD",
                                     "Value":  0.0000
                                 },
                      "CostCategoryId":  "Labor",
                      "Rate":  {
                                   "CurrencyTypeId":  "USD",
                                   "Value":  37.2600
                               },
                      "StartDate":  "2025-06-24T06:42:00",
                      "Duration":  0,
                      "RuleModification":  "None",
                      "Employee":  {
                                       "Id":  1529
                                   },
                      "Quantity":  0.00000,
                      "LaborCode":  {
                                        "Id":  102
                                    },
                      "TypeId":  "Cost",
                      "TaxAmount":  {
                                        "CurrencyTypeId":  "USD",
                                        "Value":  0.0000
                                    },
                      "WithholdingTaxRate":  0.0,
                      "NonBillable":  false,
                      "MerchantName":  "",
                      "ConcurrencyId":  1,
                      "Id":  79
                  },
                  {
                      "WoId":  852,
                      "CurrencyTypeId":  "USD",
                      "Comment":  "John Doe - 51110",
                      "Amount":  {
                                     "CurrencyTypeId":  "USD",
                                     "Value":  49.0600
                                 },
                      "CostCategoryId":  "Labor",
                      "Rate":  {
                                   "CurrencyTypeId":  "USD",
                                   "Value":  37.2600
                               },
                      "StartDate":  "2025-06-24T08:00:00",
                      "Duration":  79,
                      "RuleModification":  "None",
                      "Employee":  {
                                       "Id":  1529
                                   },
                      "Quantity":  1.31667,
                      "LaborCode":  {
                                        "Id":  102
                                    },
                      "TypeId":  "Cost",
                      "TaxAmount":  {
                                        "CurrencyTypeId":  "USD",
                                        "Value":  0.0000
                                    },
                      "WithholdingTaxRate":  0.0,
                      "NonBillable":  false,
                      "MerchantName":  "",
                      "ConcurrencyId":  2,
                      "Id":  89
                  },
                  {
                      "WoId":  852,
                      "CurrencyTypeId":  "USD",
                      "Comment":  "John Doe - 51110",
                      "Amount":  {
                                     "CurrencyTypeId":  "USD",
                                     "Value":  74.5200
                                 },
                      "CostCategoryId":  "Labor",
                      "Rate":  {
                                   "CurrencyTypeId":  "USD",
                                   "Value":  37.2600
                               },
                      "StartDate":  "2025-06-25T08:00:00",
                      "Duration":  120,
                      "RuleModification":  "None",
                      "Employee":  {
                                       "Id":  1529
                                   },
                      "Quantity":  2.00000,
                      "LaborCode":  {
                                        "Id":  102
                                    },
                      "TypeId":  "Cost",
                      "TaxAmount":  {
                                        "CurrencyTypeId":  "USD",
                                        "Value":  0.0000
                                    },
                      "WithholdingTaxRate":  0.0,
                      "NonBillable":  false,
                      "MerchantName":  "",
                      "ConcurrencyId":  2,
                      "Id":  201
                  },
                  {
                      "WoId":  852,
                      "CurrencyTypeId":  "USD",
                      "Comment":  "John Doe - 51110",
                      "Amount":  {
                                     "CurrencyTypeId":  "USD",
                                     "Value":  74.5200
                                 },
                      "CostCategoryId":  "Labor",
                      "Rate":  {
                                   "CurrencyTypeId":  "USD",
                                   "Value":  37.2600
                               },
                      "StartDate":  "2025-06-26T09:00:00",
                      "Duration":  120,
                      "RuleModification":  "None",
                      "Employee":  {
                                       "Id":  1529
                                   },
                      "Quantity":  2.00000,
                      "LaborCode":  {
                                        "Id":  102
                                    },
                      "TypeId":  "Cost",
                      "TaxAmount":  {
                                        "CurrencyTypeId":  "USD",
                                        "Value":  0.0000
                                    },
                      "WithholdingTaxRate":  0.0,
                      "NonBillable":  false,
                      "MerchantName":  "",
                      "ConcurrencyId":  4,
                      "Id":  290
                  },
                  {
                      "WoId":  852,
                      "CurrencyTypeId":  "USD",
                      "Comment":  "John Doe - 51110",
                      "Amount":  {
                                     "CurrencyTypeId":  "USD",
                                     "Value":  0.0000
                                 },
                      "CostCategoryId":  "Labor",
                      "Rate":  {
                                   "CurrencyTypeId":  "USD",
                                   "Value":  37.2600
                               },
                      "StartDate":  "2025-06-30T06:44:00",
                      "Duration":  0,
                      "RuleModification":  "None",
                      "Employee":  {
                                       "Id":  1529
                                   },
                      "Quantity":  0.00000,
                      "LaborCode":  {
                                        "Id":  102
                                    },
                      "TypeId":  "Cost",
                      "TaxAmount":  {
                                        "CurrencyTypeId":  "USD",
                                        "Value":  0.0000
                                    },
                      "WithholdingTaxRate":  0.0,
                      "NonBillable":  false,
                      "MerchantName":  "",
                      "ConcurrencyId":  2,
                      "Id":  514
                  },
                  {
                      "WoId":  852,
                      "CurrencyTypeId":  "USD",
                      "Comment":  "Service Provider Trip Charge",
                      "Amount":  {
                                     "CurrencyTypeId":  "USD",
                                     "Value":  98.0000
                                 },
                      "CostCategoryId":  "Labor",
                      "Rate":  {
                                   "CurrencyTypeId":  "USD",
                                   "Value":  98.0000
                               },
                      "Duration":  0,
                      "InvoiceItem":  {
                                          "Id":  461
                                      },
                      "RuleModification":  "None",
                      "Quantity":  1.00000,
                      "TypeId":  "ServiceFee",
                      "TaxAmount":  {
                                        "CurrencyTypeId":  "USD",
                                        "Value":  0.0000
                                    },
                      "WithholdingTaxRate":  0.0,
                      "NonBillable":  false,
                      "MerchantName":  "",
                      "ConcurrencyId":  2,
                      "Id":  22873
                  },
                  {
                      "WoId":  null,
                      "CurrencyTypeId":  "USD",
                      "Comment":  "Test trip charge fee added via API script.",
                      "Amount":  {
                                     "Value":  99,
                                     "CurrencyTypeId":  "USD"
                                 },
                      "CostCategoryId":  "Labor",
                      "Rate":  {
                                   "Value":  99,
                                   "CurrencyTypeId":  "USD"
                               },
                      "StartDate":  "2025-11-02T09:58:08",
                      "Duration":  60,
                      "RuleModification":  "None",
                      "Employee":  null,
                      "Quantity":  1,
                      "LaborCode":  null,
                      "TypeId":  "ServiceFee",
                      "TaxAmount":  {
                                        "Value":  0,
                                        "CurrencyTypeId":  "USD"
                                    },
                      "WithholdingTaxRate":  0,
                      "NonBillable":  false,
                      "MerchantName":  "",
                      "ConcurrencyId":  21,
                      "InvoiceItem":  {
                                          "Id":  461
                                      }
                  }
              ],
    "ServiceFeesTotal":  {
                             "CurrencyTypeId":  "USD",
                             "Value":  98.0000
                         },
    "CostStatusId":  3,
    "CostState":  "Approved",
    "ChargeCode":  {
                       "Id":  261
                   },
    "BillingAccount":  {
                           "Id":  14
                       },
    "ExternalId":  "",
    "TaxIdPrimary":  "",
    "TaxIdSecondary":  "",
    "CanExpedite":  false,
    "CanEarlyPayment":  false,
    "IsAvailableExpeditedInvoiceFlags":  false,
    "ConcurrencyId":  21                                                                                                                           
	}                                                                                                                                                  
	}    

Thanks!