How to Create a Custom Button in TallyPrime Using TDL
TallyPrime can be customized with TDL to add buttons, fields, reports and workflow shortcuts. In this example, we add a custom button to the Gateway of Tally.
Version note: Test this code in TallyPrime Developer using a release-compatible TDL environment. Always keep a backup and test with a backup company.
TDL code
;; =========================================================
;; OTS Custom Gateway Button
;; Test in TallyPrime Developer
;; =========================================================
[#Form: Gateway of Tally]
Add : Button : OTS Help Button
[Button: OTS Help Button]
Title : "OTS Help"
Key : Alt + H
Action : Display : OTS Help Report
[Report: OTS Help Report]
Form : OTS Help Form
Title : "OTS TDL Help"
[Form: OTS Help Form]
Parts : OTS Help Part
[Part: OTS Help Part]
Lines : OTS Help Line1, OTS Help Line2, OTS Help Line3
[Line: OTS Help Line1]
Fields : OTS Help Field1
[Line: OTS Help Line2]
Fields : OTS Help Field2
[Line: OTS Help Line3]
Fields : OTS Help Field3
[Field: OTS Help Field1]
Use : Name Field
Set As : "Welcome to the custom TDL help screen."
Width : 60
[Field: OTS Help Field2]
Use : Name Field
Set As : "Use this area for instructions or support information."
Width : 60
[Field: OTS Help Field3]
Use : Name Field
Set As : "Press Esc to return to the Gateway of Tally."
Width : 60How the code works
- The Gateway of Tally form is extended with a new button.
- Alt + H opens the custom report.
- The report uses a separate form, part, lines and fields.
- Unique names beginning with OTS help prevent conflicts with other TDL files.
How to load the TDL
- Open TallyPrime Developer.
- Create a new TDL file.
- Paste the complete code.
- Compile or load the file in a test company.
- Open the Gateway of Tally.
- Select OTS Help or press Alt + H.
- Press Esc to return.
Safe testing checklist
Test the button after opening different companies and after loading other custom TDL files. Confirm that the shortcut does not replace an existing important key. Keep the default TallyPrime screens available, and do not test custom code directly on live company data.
Troubleshooting
- Button does not appear: Confirm that the TDL loaded successfully and that the active form is Gateway of Tally.
- Shortcut does not work: Check whether another TDL or TallyPrime function already uses Alt + H.
- Report opens blank: Verify the report, form, part, line and field names.
- Errors appear after an upgrade: Compare the code with the TDL definitions supported by your TallyPrime release.
Conclusion
A small custom button is a useful starting point for TDL customization. After testing this example, you can connect the button to a custom report, dashboard, calculator or business workflow. Keep each customization in a separate file and maintain a tested backup version.