{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Dynamic Fields","description":"Developer documentation for the WHMCS API — the","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"dynamic-fields","__idx":0},"children":["Dynamic Fields"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Dynamic fields are a special type of notification setting."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A dynamic field is rendered as a dropdown menu and is recommended for settings where the list of options and choices need to be populated with a poll or fetch from a remote service or API."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An example use case is demonstrated in our HipChat and Slack notification providers, where Dynamic Fields are used to provide a list of Channels and Rooms that are fetched in real-time from the respective APIs."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Below is an example of a \"channel\" dynamic field."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"public function notificationSettings()\n{\n    return [\n        'channel' => [\n            'FriendlyName' => 'Notification Channel',\n            'Type' => 'dynamic',\n            'Description' => 'Choose the notification channel for the alert.',\n        ],\n    ];\n}\n\npublic function getDynamicField($fieldName, $settings)\n{\n    $values = [];\n\n    if ($fieldName == 'channel') {\n\n        // Perform remote API call, query or database fetch and build an array:\n        //\n        // $values[] = [\n        //     'id' => '123',\n        //     'name' => 'Demo Room',\n        //     'description' => 'Room ID',\n        // ];\n\n    } elseif ($fieldName == '...') {\n        // ....\n    }\n\n    return [\n        'values' => $values,\n    ];\n}\n"},"children":[]}]},"headings":[{"value":"Dynamic Fields","id":"dynamic-fields","depth":1}],"frontmatter":{"title":"Dynamic Fields","seo":{"title":"Dynamic Fields"}},"lastModified":"2026-08-03T17:00:42.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/notification-providers/dynamic-fields","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}