How to Display Account Credit Limit and Balance on a Dynamics 365 Order Form
Question details
The user needs to display an account's credit limit and current balance on a Dynamics 365 order form, having mistakenly considered Microsoft Office VBA for the task.

- Product
- Microsoft Dynamics 365
- Device & OS
- not provided
- Scenario
- Customizing a Dynamics 365 order form to retrieve and display financial details like credit limit and balance for a selected account.
- Observed behavior
- The user is looking for the correct customization methodology, as VBA is not supported for web-based Dynamics 365 forms.
Ensure you have System Administrator or System Customizer permissions in your Dynamics 365 environment before attempting to modify order forms and web resources.
Retrieve and Display Credit Info via JavaScript
Utilize platform-supported JavaScript to fetch the account's credit details and display them as a notification on the order form.
Microsoft Office VBA applies to desktop applications like Word and Excel, but Dynamics 365 requires web-supported technologies. Using JavaScript with the Dynamics 365 Client API is the standard method for executing logic on form events.
Open the Dynamics 365 Solution Explorer, navigate to Web Resources, and click 'New' to create a new JavaScript file.
Write a JavaScript function using 'Xrm.WebApi.retrieveRecord' to fetch the Credit Limit and Balance fields from the associated Account record.
Inside your script's success callback, use 'Xrm.Page.ui.setFormNotification' to display the retrieved financial values as an informational notification at the top of the Order form.
Navigate to the Order form editor, add your JavaScript web resource to the Form Libraries, and bind the function to the 'OnLoad' event or the 'OnChange' event of the Account lookup field.
Click 'Save' in the form editor, then click 'Publish' to apply the customizations to your environment.

Implement Power Platform Customizations
An alternative no-code or low-code approach using native Power Platform tools like Business Rules and Power Automate to handle credit data.
Need to Analyze Exported CRM Data? Try WPS Office
While customizing Dynamics 365 web forms requires Power Platform tools instead of Office VBA, you still need reliable software to analyze exported CRM data. WPS Office provides a free, lightweight, and highly compatible alternative to Microsoft Office for managing all your reports and spreadsheets.
- 1. Export CRM Data: Export your account or order records from Dynamics 365 to an Excel file using the export function in the command bar.
- 2. Open with WPS: Open the downloaded .xlsx file seamlessly in WPS Spreadsheet.
- 3. Analyze Data: Use built-in pivot tables, formatting, and formulas to analyze credit limits and balances effortlessly.

Frequently Asked Questions
Why can't I use Microsoft Office VBA for Dynamics 365 customizations?
VBA (Visual Basic for Applications) is specifically designed for desktop Microsoft Office applications like Word, Excel, and Access. Dynamics 365 is a web-based platform that requires web-standard technologies like JavaScript, Power Automate, or Business Rules for form customizations.
How do I show a warning message if the order exceeds the credit balance?
You can use a Dynamics 365 Business Rule to compare the order amount against the account credit limit. If the condition is met, the Business Rule can trigger an error message or recommend an action directly on the form without needing custom code.
Do I need a developer to customize the order form?
Not necessarily. While JavaScript requires coding knowledge, you can achieve similar results using no-code tools like Business Rules and Power Automate within the Power Platform to retrieve and display account information.
Can I pull credit limit data from an external ERP system into Dynamics 365?
Yes, you can use Power Automate or custom integration APIs to sync external financial data into custom fields on the Dynamics 365 Account record. Once synced, those fields can be accessed and displayed on the order form using the methods described.




