Tuesday, March 13, 2018

AX Compile error - CREATE TABLE permission denied in database 'tempdb'.

While doing a full compile in AX, I received the following error:

I know that permissions hadn't changed so it couldn't have been an issue with that.
Recently, some maintenance had been performed on this environments SQL and AOS servers so I decided to give SQL a reboot first, followed by the AOS server.

This did the trick!  Compile worked fine after that.

Friday, February 2, 2018

Update conflict occured

Lately I have been getting a few of these errors on Time Sheets and Expense reports when trying to Submit:

Cannot edit a record in Timesheet weekly hours (TSTimesheetLineWeek).
An update conflict occurred due to another user process deleting the record or changing one or more fields in the record.

It always appears to be one of the lines in the time sheet.  If I remove the offending line, it will submit without issue.

Not sure why the line is showing that error.  Each line is a different customer but when we do 2 timesheets with their own Customer, everything works ok.

This may be related to an enhancement done by our partner.

I found a post that I think was related to this.  The poster gave me this to clean out the Database log to fix this error:

System administration -> Inquiries -> Database -> Database Log -> Clean up log

I left the query blank so it would clean up all log entries.

Many thanks to DAX_ajsqd2 on the AX Forum for helping me out with this! 

Thursday, January 18, 2018

Ledger account is not among accounts in account group

In working with my customer, I found that they were needing to do a VAT adjustment for a customer invoice that shouldn't have charged VAT.  They were able to credit the customer, but didn't really do it the right way.

Here is how I achieved the adjustment via General Journal.

Here is the scenario:

1. Customer was invoiced and charged VAT on the invoice.
2. Customer should not have been charged VAT and therefore needed a credit of the VAT amount.
3. Due to the situation they were in at the time (Long store... ...), they created a Journal to get that credit to the customer.
4. The journal went from the 'Customer' to an offset account.  This is some sort of holding account. (NON VAT account).
5. Now, we are trying to create a journal that will move the refund from that holding account into the proper VAT account.
6. When adding in the 'VAT COde' on the 'General' tab, we get the following error:
Ledger account [holding account] is not among the accounts in account group [Ledger Posting Group] that are used for VAT code [VAT Code]
This was true as my 'holding account' was not part of my Ledger Posting Profile under VAT in GL.
However, it still didn't  make sense.  To get this to work I had to:
1. Make the 'Account' in the journal line be the VAT account
2. Make the 'Offset account' in the journal line be the non-VAT 'holding account'.
3. Set my amount as a debit.
4. Set my VAT code.
5. POST!

Worked great!

Wednesday, January 17, 2018

Cannot execute a data definition language command on

While posting a timesheet, one of my users received the following error:

Cannot execute a data definition language command on Source document line (SourceDocumentLineTmpJournalize). Reference table ID: 0, None.
The record already exists.


Very interesting error.  Based on this blog post, it seems an AOS restart may fix the issue.  I will try it here shortly...

AOS Restart did not fix the issue.... Continuing on...

Not sure why, but creating a new time sheet did the trick.  Posted perfectly.

Friday, December 29, 2017

Illegal entry in an array.

I have an issue that is returning a very strange error from Enterprise Portal.
Initially I receive the following in my browser:

An unhandled error has occurred. To view details about this error, enable debugging in the web.config file or view the Windows event logs.

Upon checking the event viewer on the EP IIS machine, I see the following:

An unhandled error has occurred. To view details about this error, enable debugging in the web.config file or view the Windows event logs.

Error executing code: Illegal entry in an array.

Stack trace

(C)\Data Dictionary\Tables\myTable\Methods\label - line 34


   at Microsoft.Dynamics.AX.ManagedInterop.Record.CallWithReturnType(String methodName, Type returnType, Object[] paramList)
   at Microsoft.Dynamics.Framework.BusinessConnector.Session.DynamicsRecordAdapter.Call(String methodName, Object param1)

As of this writing, I have no idea what 'Illegal entry in an array' means.

Stay tuned...

Temporary Solution:
Well, I couldn't find a good solution for this. So here is the work around.
Original code throwing the error:

return mytable.myFieldArray[_arrayIndex];

Instead I do:

switch (_arrayIndex)
        case 1:
            retValue = this.AttrFieldLabel[1];
        case 2:
            retValue = this.AttrFieldLabel[2];
        case 3:
            retValue = this.AttrFieldLabel[3];
        case 4:
            retValue = this.AttrFieldLabel[4];

return retValue;

Hardcoding the index numbers on the array call seems to have solved my issue for now.

Happy coding!

Friday, December 15, 2017

SSRS Reports don't show labels

SSRS Reports aren't showing labels. Only Labels!@SYSxxxxx

This suddenly showed up after a code move.  It was preceded by an 'XppBridgeException' when running a single report (Print Invoice Journal).  There are a few posts out there with potential solutions such as checking your reporting service account password.  Our password never changes so there is no issue there.
I tried restarting the AOS.  Didn't work.  Cleared all cache.  Didn't work. Deployed all reports.  Didn't work.

Solution, hopefully, forthcoming...


A Full CIL and reboot of our AOS servers and our SQL server has solved this problem.

Monday, November 6, 2017

Determine if code is running in Batch

Recently I was tasked with fixing an issue where our Project invoice proposals were not posting while in batch. 
I discovered that 'WinAPI' was being called in some custom code and was able to fix it.
However, I also realized that the custom code that was being used need to be called in Batch ONLY.  Due to some issues with Citrix and the AX Client, I had to prevent the AX Client from running this code.

This proved to be difficult as I was about 4 classes deep into Proposal posting and the isRunningBatch() method isn't available. (Or at least I couldn't find a way to get back to the 'RunBaseBatch' class).

So, I found a quick little solution that appears to be working:

xSession xSession = new xSession();

Whereas our batch server is never used for the client, I can just check the the AOSName against my batch server name and run code if they match.

Probably not the best solution, but it seems to work.