Skip to main content

I am trying to both add and update Equipment to CityWorks using the HTTPCaller - it seems to work fine except for custom fields.  They do not seem to add or update with the equipment record. I am passing in the “Data” query string parameter with the following json data:

{"EquipmentUid":"@Value(EQUIPMENTUID)",
"Description": "@Value(DESCRIPTION)",
"Manufacturer": "@Value(MAKE)",
"Model": "@Value(MODEL)",
"ForCheckout": "@Value(FORCHECKOUT)",
"RateType": "@Value(RATETYPE)",
"UnitCost": "@Value(HOURLY_RATE)",
 "CustomFields": 
    {
      "FieldName": "DIVISION CATEGORY",
      "FieldValue": "@Value(DEPT_ID_DESC)"
    }
 }
 

This does not work but is what I could gather from the internet as correct (for the custom fields)

Hi,

Unfortunately, you can’t add CustomFields directly on the Add or Update Equipment endpoints.

The element to use is CustomFieldValues and it expects a Dictionary with key-value pairs.
The API documentation says: Dictionary<Int32, String>  CustomFieldValues

Example:

{

    "EquipmentUid": "@Value(EQUIPMENTUID)",

    "Description": "@Value(DESCRIPTION)",

    "Manufacturer": "@Value(MAKE)",

    "Model": "@Value(MODEL)",

    "ForCheckout": "@Value(FORCHECKOUT)",

    "RateType": "@Value(RATETYPE)",

    "UnitCost": "@Value(HOURLY_RATE)",

    "CustomFieldValues": {

        "1": "CustFieldVal_1",

        "2": "CustFieldVal_2",

        "3": "CustFieldVal_3"

    }

}

 

You will need to find your CustomFields and create the dictionary before generating the JSON request.

 


Thanks for the clarity and it worked fine after making that change!  I had seen that in the API documentation but when I lookin on line there where several posts that used “CustomFields”