The system configuration is the heart of any extension from where every functionalities and feature can be handled by the store owner. It enables Magento developer to scale and meet customer’s requirements. Till date, we have written several blogs regarding adding different configuration fields in our MageComp Blog. But many times you came across the requirement of capturing multiple values irrespective of the number of values, at that time we need to use the dynamic field inside backend configuration so the admin can add multiple values using the backend.

Recently we have written a blog on “How to get Dynamic Generated row value of System Configuration in Magento 2” where you can learn how to fetch values using this dynamic field block, but after that blog some of our readers requested us to write another blog on “How to Create Dynamic Generated Field inside Magento 2 backend configuration”. Because as a developer, many times you need to fetch multiple user inputs at that time making use of Dynamic Generated Field can make your work easy. So simply follow the below steps and create your own dynamic value field in Magento 2 backend configuration.

First, we need to create “Module.xml” file inside our custom extension etc folder.
app\code\Vendor\Extension\etc\Module.xml

After that, we need to create one more “Adminhtml.xml” in the same folder using below code.
app\code\Vendor\Extension\etc\Adminhtml.xml

Now we need to create one more file “Fileextension.php” at this path.
app\code\Vendor\Extension\Block\Adminhtml\Fileextension.php

In this last step we need to create “Fileextension.php” for creating backend configuration field.
app\code\Vendor\Extension\Block\Adminhtml\Config\Backend\Fileextension.php

Tadaa! You have successfully created a dynamic field in backend configuration now you are free to manipulate this code according to your development needs.

If you found this blog helpful, don’t forget to share it with your colleagues and Magento Friends.

And, Let us know if you are facing an issue while implementing this code.

Happy Coding!

Click to rate this post!
[Total: 12 Average: 5]