web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Custom script failed to run in production environment

(0) ShareShare
ReportReport
Posted on by 6
Hi All,
 
 
I have created a custom script to be run in production environment. We have tested in lower environments like preprod and dev. There was no issue whatsoever. When the same script is being run in production. I get the below error.
 
[8/29/2025 11:54:08 am] Test run started
[8/29/2025 11:54:17 am] Exception has been thrown by the target of an invocation.
[8/29/2025 11:54:17 am]    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Dynamics.AX.Application.AppConsistencyCustomScriptFile.executeScript()
   at Dynamics.AX.Application.AppConsistencyCustomScriptStateChange.runScript()
   at Dynamics.AX.Application.AppConsistencyCustomScriptStateChange.process(Boolean _isTestRun)
[8/29/2025 11:54:23 am] SQL statement: UPDATE APPCONSISTENCYCUSTOMSCRIPT SET LOG='',RECVERSION=972777893,MODIFIEDDATETIME='2025-8-29',MODIFIEDBY='APP_D365_ADMIN02' WHERE ((RECID=5637173826) AND (RECVERSION=595582687))
[8/29/2025 11:54:23 am] SQL statement: UPDATE APPCONSISTENCYCUSTOMSCRIPT SET LOG='',RECVERSION=1691892766,MODIFIEDDATETIME='2025-8-29',MODIFIEDBY='APP_D365_ADMIN02' WHERE ((RECID=5637173826) AND (RECVERSION=972777893))
[8/29/2025 11:54:23 am] Completed
Categories:
I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    297,207 Super User 2025 Season 2 on at
    Custom script failed to run in production environment
    Hi,

    When reading the question, I do assume you are using the option for running custom scripts without downtime? Did you do the same in DEV and PREPROD? Note that some tables are restricted to be updated. Can you tell what exact tables and updates to them you are trying to execute?
  • Suggested answer
    Sagar121 Profile Picture
    250 on at
    Custom script failed to run in production environment
    Hi, 
     
    You should retry. Sometimes Custom script don't run at first go. 
     
    If this don't work then try to run script when no-one is using System.
  • Suggested answer
    Adis Profile Picture
    5,405 Super User 2025 Season 2 on at
    Custom script failed to run in production environment
    Hi,
     
    On the first sight, I would assume that you have different parameters or data in Prod and Sandboxes. What I would do, is to copy PROD to a sandbox and then try to execute the script. 
     
    The developer who created the script should be able to tell you whats wrong or how to fix it. Once you fix it in the sandbox and everything works fine, then you can fix it in PROD.
     

    Kind regards, Adis

     

    If this helped, please mark it as "Verified" for others facing the same issue

    Keep in mind that it is possible to mark more than one answer as verified

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 665 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 595 Most Valuable Professional

#3
Yng Lih Profile Picture

Yng Lih 558

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans