How to find scripts which call a script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2020 05:28 PM
Hi,
I would like to know how to find scripts which call a script include.
I have to change the script include for a reason but I need to check if there is any script calling it which I don't know.
Best Regards,
Kohei
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2024 02:40 PM
If you know how to get the script to execute, but don't know what exactly is calling that script, an option that doesn't require you to search through various code bases is to add a stacktrace log to the script include.
Add:
var msg = new NiceError("Some log message");
gs.info(msg)
To the method in question and you'll find the log contains a stack trace which will show you which script called the script include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2024 06:22 AM
Your idea is good but you don't know when the code will call this script include will be triggered, you don't even know which type of items this script is used if it's a BR or scheduled job or even a custom action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2024 06:17 PM
@Kohei4 You can use OOB code search to find what scripts are using it. Please check below.
Please mark my answer correct and helpful if this works for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2024 06:39 PM - edited ‎09-25-2024 06:43 PM
@Kohei4 In addition to the methods mentioned in earlier replies, I usually follow steps listed below to find the sources where a script is used. Unlike other options, this approach covers anything that's captured in an updateset.
1. Navigate to "System Update Sets > Local Update Sets"
2. Open any one of the updateset from the list (For E.g., open Default updateset in global scope).
3. In the updateset form view, open the related list "Customer Updates" in a new tab as shown in the below screenshot.
4. In the resulting list view, remove any existing filter and set the new filter as "Payload CONTAINS scriptIncludename".
5. Result will display all items where the script has been used.
6. Group by column "Type" to make it easier to view.
Note: Since scheduled jobs are usually not captured in updateset, it won't be reflected in the results. But if you manually capturing the scheduled jobs in the updateset then this approach will cover that too.
PS: Hit "Correct", "Helpful" or "Like" depending on the impact of the response.
Regards,
Kamal S