Script Finder in XrmToolBox:
Introduction
===> When working with complex Dynamics 365 CRM implementations, JavaScript customizations are widespread across forms, libraries, and events.
===> As solutions grow in complexity, it becomes increasingly difficult to track where specific JavaScript functions are used or which libraries are deployed on various forms.
===> This is where the Script Finder tool in the XrmToolBox comes to the rescue.
===> Script Finder provides a fast, efficient way to search, analyze, and manage JavaScript customizations across your CRM system, saving time and reducing human error.
What is Script Finder?
===> When you customize Dynamics 365 CRM, you often use JavaScript to make things happen on forms — like showing or hiding fields, validating data, or doing calculations.
===> Over time, these scripts get added to many forms and events (like onLoad, onChange, onSave.), and it becomes hard to remember.
Where did I use a specific JavaScript function?
Which form is using which script?
Are there any old or unused scripts I can remove?
That’s where Script Finder helps you!
Why Use Script Finder?
===> As your CRM system grows:
You forget where a specific function is used.
You want to update or fix a script but don’t know which forms are using it.
You want to remove old or unused JavaScript files.
You want to check everything before moving a solution to Production.
===> Script Finder solves these problems by showing you:
All the JavaScript files (web resources) attached to forms.
Which functions are used.
Which events (onLoad, onChange, onSave) are calling those functions.
When to Use Script Finder?
Fixing bugs: Quickly find which forms/events are using the function causing the issue.
Cleaning up: Identify old or unused scripts.
Updating code: Find all places a function is used before changing it.
Before deployment: Ensure no old/test scripts are left.
Documentation: Create a report of all scripts and functions used.
Where is Script Finder Used?
It's part of XrmToolBox, which is a Windows app for Dynamics 365 CRM tools.
You install Script Finder as a plugin inside XrmToolBox.
It works with Model-Driven Apps in Dynamics 365 CRM.
Business Case Scenario:
Your CRM has a custom JavaScript function called validateDiscount() written 2 years ago. Now the business wants to change the discount logic and update the function.
But here’s the problem:
You don’t know where validateDiscount() is being used.
It might be used in multiple places: Opportunity, Quote, and Order forms.
If you update the function without knowing where it’s used, you could break other parts of the system.
Step 1: Open XrmToolBox and Connect to CRM
Open XrmToolBox and connect to your CRM organization.
Step 2: Open Script Finder
Search and open Script Finder.
If not available, install it from the Plugin Store.
Step 3: Click "Retrieve Scripts"
This scans all forms, all entities, and all JavaScript libraries.
Wait for it to finish – it may take a few minutes in large environments.
Step 4: Search for the Function Name
In the search box, type: validateDiscount
You see the below result:
Step 5: Analyze
Now you know:
validateDiscount() is used in three different entities.
It's triggered: On field change in Opportunity and Order forms and On form load in Quote.
If you had changed the function without knowing this, it could have broken the quote form or order form validation!
Step 6: Take Action
1. Back up the original JavaScript file.
2. Carefully update validateDiscount() and test it in:
Opportunity form (when discountpercent field is changed)
Quote form (on form load)
Order form (on manualdiscount field change)
3. Use Script Finder again after updates to confirm it’s still correctly linked.
Without Script Finder:
Guessing where a function is used
High risk of breaking forms
Difficult clean-up of old code
Time-consuming manual checks
With Script Finder
Open Script Finder in XrmToolBox
Search for validateDiscount()
It instantly shows you where that function is used
Now you can go to those specific forms and update or remove it
Done in minutes, not hours!
Important Note:
Script Finder only scans form-level scripts, not JavaScript triggered from ribbons, command bars, or custom controls.
It doesn't parse function definitions within web resources unless clearly defined—nested or dynamic functions may not be picked up.