Ok so I have a custom field in the extension of SalesTable. I have to update the value of the field across the whole table. So I used this code.
public static void main(Args _args)
{
try
{
str sql = @"
UPDATE SalesTable
SET EVS_TERMSENUM = 0 WHERE dataareaid = ‘sc’
";
Evs_SalesTableUpdateTerms obj = new Evs_SalesTableUpdateTerms();
obj.ExecuteSQLQuery(sql);
info("Records updated successfully");
}
catch(Exception::Error)
{
ttsabort;
info(strFmt("error : %1", infolog.text()));
}
}
public void ExecuteSQLQuery(str sql)
{
Connection connection = new Connection();
Statement statement;
ResultSet resultSet;
SqlStatementExecutePermission perm;
perm = new SqlStatementExecutePermission(sql);
perm.assert();
statement = connection.createStatement();
statement.executeUpdate(sql);
}
But when I created the package, uploaded it on Custom Scripts, and Ran Test after approving it, i got this error.
[8/4/2026 10:48:31 am] Test run started
[8/4/2026 10:53:36 am] Exception has been thrown by the target of an invocation.
[8/4/2026 10:53:36 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/4/2026 10:53:41 am] Infolog:
Cannot execute the required database operation.
A time-out occurred in the database while the query was executing.
<Scrubbed Direct Sql query>
[8/4/2026 10:53:41 am] Completed
Can someone help kindly.