In this article, we will introduce you the powerful “Custom Fields” functionality of GoFreight FMS, which provides editable dynamic fields and empowers you to tailor the system according to your specific needs.

What are Custom Fields?

Custom Field is a powerful feature within GoFreight that allows you to extend the capabilities of your freight forwarding processes. With Custom Fields, you can enhance the system records and the forms on different entity pages, such as invoices, MBLs, and more. These fields can be uniquely customized to store the information that is most relevant to your business.

For example, after a field Transfer Status (ID: transfer_status, type: boolean) and another field Status Message (ID: status_message, type: text) are configured for invoice entity, two additional fields will emerge on your invoice entry page, as shown below.

Interact with Custom Fields via APIs

Invoices APIs

You can list the configured custom fields of invoice entity via the REST API GET /api/v1/invoices/custom-field/, for example:

curl --request GET
    --url 'https://api.core.gofreight.co/api/v1/invoices/custom-field' \
    --header 'Accept: application/json' \
    --header 'X-GATEWAY-TOKEN: {{your-api-key}}'

and here’s the sample response:

{
    "data": [
        {
            "name": "transfer_status",
            "label": "Transfer Status",
            "description": "The boolean field indicating the status of invoice transferring.",
            "type": "boolean"
        },
        {
            "name": "status_message",
            "label": "Status Message",
            "description": "The text field that records the message regarding the invoice transfer status.",
            "type": "text"
        }
    ]
}

You can also update the custom fields of an invoice via the REST API PATCH /api/v1/invoices/, for example:

curl --request PATCH 
    --url 'https://api.core.gofreight.co/api/v1/invoices' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'X-GATEWAY-TOKEN: {{your-api-key}}' \
    --data '{
        "data": [
            {
                "ref": "1",
                "$cf": {"transfer_status": true, "status_message": "foobar"}
            },
            {
                "ref": "2",
                "invoice_date": "2023-12-31",
                "$cf": {"transfer_status": false}
            }
        ]
    }'

and the response would contains the ID (ref) and the URI (uri) of updated invoices.

{
    "data": [
        {
            "ref": "1",
            "uri": "/api/v1/invoice/1/"
        },
        {
            "ref": "1",
            "label": "/api/v1/invoice/2/"
        }
    ]
}

Please refer the API documentation for more details.