Tuesday, October 14, 2014

DIXF timeout issues

DIXF - Interesting find

I spent the past 2 weeks doing data migration and here are some interesting errors I found and how to fix them:

Several issues can be seen with large amounts of records (more than 200k - 300k) and medium amounts of records (around 200k) with a lot of data.
Here is the error:

System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to http://myServer:7000/DMFService/DMFServiceHelper.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host 
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) 
--- End of inner exception stack trace --- 
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) 
at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) 
at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) 
--- End of inner exception stack trace --- 
at System.Net.HttpWebRequest.GetResponse() 
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) 
--- End of inner exception stack trace --- 

Server stack trace: 
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason) 
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) 
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) 
at System.ServiceModel.Channels.ClientReliableChannelBinder`1.RequestClientReliableChannelBinder`1.OnRequest(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode) 
at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode) 
at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.Request(Message message, TimeSpan timeout) 
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) 
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 

Exception rethrown at [0]: 
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 
at Microsoft.Dynamics.AX.Framework.Tools.DMF.ServiceProxy.DMFServiceReference.ServiceContract.ShowPreview(DMFEntity entity) 
at Microsoft.Dynamics.AX.Framework.Tools.DMF.ServiceProxy.DmfEntityProxy.DoWork[T](Func`1 work)


We solve this by adding 'recieveTimeout' and 'sendTimeout' into the C:\Program Files\Microsoft Dynamics AX\60\DataImportExportFramework/Microsoft.Dynamics.AX.Framework.Tools.DMF.SSISHelperService.exe.config


<bindings>
      <wsHttpBinding>
        <binding name="DMFService_WsHttpBinding" receiveTimeout="01:00:00"
sendTimeout="01:00:00"
          maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647"             maxNameTableCharCount="2147483647" />
        </binding>
      </wsHttpBinding>
    </bindings>

Thursday, September 18, 2014

Check if user has access set up on a menu item

Recently I was working on a project where I needed to check if the user had security access to a Menu Item.  The menu item wasn't being used, but it had the security access that I wanted to check.

Very simply, I was able to use this:

Global::hasMenuItemAccess(...);

Worked great!

Thursday, August 14, 2014

Recently I was working on a project where I was calling into a class and I needed to verify the record that was coming in.  Here is how I did it:

public static void main(Args _args)
{
    MyClass                                myClass;
    RefRecId                                bankChequeTableRecId;
    FormDataSource                          formDataSource;
    ;

    myClass= MyClass::construct();
    if (_args != null && _args.dataSet() == tablenum(BankChequeTable) && _args.record().RecId != 0)
    {
        BankChequeTableRecId = _args.record().RecId;
        if (_args.record().IsFormDataSource() == true)
        {
            FormDataSource = _args.record().dataSource();
        }
    }
    if (BankChequeTableRecId != 0)
    {
        myClass.ToggleEditForAvidSync(BankChequeTableRecId);
    }
    if (formDataSource != null)
    {
        FormDataSource.research(true);
    }
}

Basically I am checking
1. _args has something
2. _args.dataSet() - Checking if this args is a BankChequeTable record
3. _args.record().RecId - Making sure there is a record in the args
4. Setting my RecId variable to the recid passed in by args.
5. _args.record().IsFormDataSource() - I want to know if this is a form data source and later one refresh that datasource.

I have needed this a lot so I thought I would post it up!

Friday, July 18, 2014

Add new Financial Dimension backing entity

Under General ledger -> Setup -> Financial dimensions, open the Financial dimensions form.  If you create a new dimension there is a list of 'Use values from'.  These are the backing entities that you can use values from.  I had a project to add something to this list.  

Rather than type everything out, here is the link to a post I found that gives a perfect description of how to accomplish this. 

Thanks!

Wednesday, June 18, 2014

SalesLine and Financial Dimensions

I was working with the SalesLine recently and needed a custom Financial Dimension added.  I found this great blog post that explains exactly how to do it:

http://www.intergen.co.nz/blog/tim-schofield/dates/2011/12/how-to-add-a-financial-dimension-in-ax-2012/


Wednesday, May 14, 2014

AX 2009 Compare form colors

I have been working a bit in AX 2009 lately and have found that the colors when comparing two objects, do not work.  A quick google search turned up this blog post:


Very good explanation of why and how to fix it. 

Thursday, April 3, 2014

Cheque_US printing 2 pages

I have been working with this report for some time now.  The idea here was that we needed the cheque to print at the BOTTOM of the page, which, according to microsoft should be really easy!

http://technet.microsoft.com/en-us/library/gg230993.aspx

Needless to say, the settings on this page didn't work.  If I tried to use the 'Check start position' to place the check on the page where I needed it, it would throw an error saying 'The starting position of the check is too far down the page.'  
The other potential solution was to just make the page longer, but then we got 2 pages printing with the 2nd page being blank!

GRRRRRR!

Finally I started digging and found out that the report has 'SlipTxt' boxes at the TOP and the BOTTOM of the report.  This is so that you can have your check print on either end and still have a stub.


From what I can tell, although the bottom 2 text boxes were 'Invisible' they still took up space and forced the printing of a second page.
Once I removed those, half of the battle was won.

The other thing I had to figure out was why I couldn't use the 'Check start position' on the check setup form to push the check further down the page.  BTW, These settings can be found in Cash and bank management -> Common -> Bank accounts -> Set up -> Check


To allow higher numbers such as 8.75 and such, you need to dig into the code in TWO places.  That's right, two places.  The 'Print test' you see here has it's own class where is the 'Generate payments' in the Payment journal lines has another class

Print Test - Classes\BankPrintTestCheque\getDocLength
Generate Payments - Classes\CustVendCheque\slipTxtLines

You will notice that you see a switch statement in each of them that looks like this:
 switch (_chequeFormType)
    {
        case ChequeFormType::USStyle,
            ChequeFormType::UKStyle,
            ChequeFormType::ESStyle,
            ChequeFormType::MXStyle,
            ChequeFormType::CAStyle,
            ChequeFormType::FRStyle :            
            chequeDocMm = 88.89;          
            break;
...
...

To allow larger numbers, you will need to change the 88.89 to something much lower.  I did mine to 18.89 and that seemed to be good enough to do what I wanted.

Good luck!