Replace Field in Response with Field from relation

System Information
  • Strapi Version: v4.17.1
  • Operating System:
  • Database: mysql
  • Node Version: v20.11.0
  • NPM Version:
  • Yarn Version:

Hello everyone,

I’m still new to Strapi and am currently familiarizing myself with it. I have the following scenario.
I have a table with orders and a customer is assigned to each order. My problem now is how do I best realize that in the response not the entire customer but only a value of the customer is transferred?

This is what the response looks like at the moment.

 "id": 1,
            "attributes": {
                "location": "FooFooBA Street",
                "customerReference": "CC0333020219",
                "meeting": null,
                "DateIn": "2024-01-18T06:15:00.000Z",
                "complete": false,
                "description": "\nWork Order Number  ",
                "createdAt": "2024-01-18T12:22:29.409Z",
                "updatedAt": "2024-01-18T12:38:40.078Z",
                "customerName": null,
                "user": {
                    "data": {
                        "id": 1,
                        "attributes": {
                            "username": " ",
                            "email": " ",
                            "provider": "local",
                            "confirmed": true,
                            "blocked": false,
                            "createdAt": "2024-01-18T12:19:07.928Z",
                            "updatedAt": "2024-01-18T12:19:07.928Z"
                        }
                    }
                },
                "customer": {
                    "data": {
                        "id": 1,
                        "attributes": {
                            "name": "PCCS Compa",
                            "createdAt": "2024-01-18T12:21:07.191Z",
                            "updatedAt": "2024-01-18T12:21:09.349Z",
                            "shortName": "PCCA"
                        }
                    }
                }
            }
        },

It should look like this

        "id": 1,
            "attributes": {
                "location": "FooFooBA Street",
                "customerReference": "CC 0333020219",
                "meeting": null,
                "DateIn": "2024-01-18T06:15:00.000Z",
                "complete": false,
                "description": "\nWork Order Number ",
                "createdAt": "2024-01-18T12:22:29.409Z",
                "updatedAt": "2024-01-18T12:38:40.078Z",
                 "customer": "PCCA"
                "user": {
                    "data": {
                        "id": 1,
                        "attributes": {
                            "username": " ",
                            "email": " ",
                            "provider": "local",
                            "confirmed": true,
                            "blocked": false,
                            "createdAt": "2024-01-18T12:19:07.928Z",
                            "updatedAt": "2024-01-18T12:19:07.928Z"
                        }
                    }
                },

                 
            }
        },

Thanks for your Help