How to get meaningful AIF messages on Web service consumer?

Sometime on your consumer code you don’t know the cause of error and you have to dig into it by looking at exception form with in AX. Although there is a way to get all the meaningful messages at your consumer end also.

Obviously “Include exception in fault” checkbox needs to be enabled on your inbound port.

inbound
After that small piece of code (Catch) block will help you to get the meaningful messages.

catch (System.ServiceModel.FaultException<AxIntegrationServiceRefCust.AifFault> aiffaultException)
            {
                AxIntegrationServiceRefCust.InfologMessage[] list = aiffaultException.Detail.InfologMessageList;

                foreach(AxIntegrationServiceRefCust.InfologMessage message in list)
                {
                    Console.WriteLine(message.Message);
                }

                return 0;
            }

Error in “Go to origin” — Alert rules notifications

a1

Error is

The form cannot find the context of the alert from here. Try to access the \’Number: 201/2013/2194530, Visa\’ record in a different way.

To fix this error we need to modify the class EVENTCONTEXTDRILLDOWN

a2

Needs to add below code inside drilldown method, code should be similar to existing code of ledgerJournalTable.

a33

Then later you can add range to your main form to filter the specific record

a4

Useful SQL Query (Part 3) – Remove database log from SQL

There are certain needs when you want to remove the database logs. Below SQL query will help you in that.

USE [master]

GO
ALTER DATABASE [TestDb] SET RECOVERY SIMPLE WITH NO_WAIT

DBCC SHRINKFILE(TestDbLog, 1)

ALTER DATABASE [TestDb] SET RECOVERY FULL WITH NO_WAIT

GO

Useful SQL Query (Part 2) – Count of records in each table from SQL

This is very useful query while doing upgrade, you can get the count of records in each table from source and target environment. This helps you with initial level of testing. I found it useful to share.

 DECLARE @QueryString NVARCHAR(MAX) ;  
 SELECT @QueryString = COALESCE(@QueryString + ' UNION ALL ','')  
            + 'SELECT '  
            + '''' + QUOTENAME(SCHEMA_NAME(sOBJ.schema_id))  
            + '.' + QUOTENAME(sOBJ.name) + '''' + ' AS [TableName]  
            , COUNT(*) AS [RowCount] FROM '  
            + QUOTENAME(SCHEMA_NAME(sOBJ.schema_id))  
            + '.' + QUOTENAME(sOBJ.name) + ' WITH (NOLOCK) '  
 FROM sys.objects AS sOBJ  
 WHERE  
    sOBJ.type = 'U'  
    AND sOBJ.is_ms_shipped = 0x0  
 ORDER BY SCHEMA_NAME(sOBJ.schema_id), sOBJ.name ;  
 EXEC sp_executesql @QueryString  
Follow

Get every new post delivered to your Inbox.

Join 306 other followers

%d bloggers like this: