> For the complete documentation index, see [llms.txt](https://dwdev.gitbook.io/dwdevelopment/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dwdev.gitbook.io/dwdevelopment/adding-business-to-phone-companies.md).

# Adding Business to Phone Companies

It's a nice touch for the business to be added to your phone app automatically.&#x20;

This follows an almost identical process to installation for mechanic scripts.

#### Creating a payload

1. Navigate to dw\_businesscreator/bridge/server.lua `AddBusinessToPhone`function
2. The payload contained within data is available for you there, modify it to fit the payload expected by your phone script.
3. Setup the export as&#x20;

   ```lua
           exports["phonescript"]:AddCompany(businessName, data)
   ```

#### Setup

1. Navigate to your phone script and create a folder named dw\_custom
2. Under dw\_custom, create a client.lua and a server.lua file
3. In the server.lua file, copy the following structure

```lua
local cachedCompanies = {}

exports("AddCompany", function(data)
    local id = #Config.CHANGEME + 1
    Config.CHANGEME [id] = data
    cachedCompanies[id] = data
    TriggerClientEvent(GetCurrentResourceName() .. ":client:addCompany", -1, id, data)
    print("Registered company with id: " .. id)
    print(json.encode(data))
    return id
end)

exports("RemoveCompany", function(id)
    Config.CHANGEME[id] = nil
    cachedCompanies[id] = nil
    TriggerClientEvent(GetCurrentResourceName() .. ":client:removeCompany", -1, id)
    return true
end)

lib.callback.register(GetCurrentResourceName() .. ":server:getExtraCompanies", function(source)
    return cachedCompanies
end)
```

3. In the client.lua file, copy the following structure

```lua
CreateThread(function()
    local cachedCompanies = lib.callback.await(GetCurrentResourceName() .. ":server:getExtraCompanies", false)
    for name, data in pairs(cachedCompanies) do 
        Config.CHANGEME[name] = data
    end
end)

RegisterNetEvent(GetCurrentResourceName() .. ":client:addCompany", function(name, data)
    Config.CHANGEME[name] = data
end)
```

Literally all you need to do here(most of the time) is change Config.CHANGEME to the actual config table name

Ez?

## That didn't work

If that didn't work, your phone script requires a bit more love. You can open a ticket either on the dwdevelopment Discord or the phone Script Discord (hopefully they help?), and you should receive support.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://dwdev.gitbook.io/dwdevelopment/adding-business-to-phone-companies.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
