Tuesday, September 25, 2018

TempDB on Forms

Spent about 2 hours trying to recall how to make tmpDB tables work with forms and sorted it out, thanks to this link http://alexvoy.blogspot.com/2018/03/tempdb-table-on-form-with-multiple.html

Just a post for reminding myself for next time

Wednesday, September 19, 2018

Find AX code snippets from SQL end like a cross reference on AX but from SQL side

I recently learned a way to find code snippets quickly using sql. This is very helpful in scenarios when cross reference is turned off and you need to find places where a particular class or function is being called from.

On the model database on sql you can write the below query and you should be able to see all the methods where that code is called from.


SELECT RootHandle.Name                                              RootElementName,
    ElementHandle.Name                                               ElementName,
    ElementTypes.ElementTypeName                              Type,
    CAST(Sources.SourceText AS nvarchar(MAX))                 SourceText
FROM Sources Sources (nolock)
    JOIN ModelElement ElementHandle (nolock)
              ON Sources.SourceHandle        = ElementHandle.ElementHandle
    JOIN ModelElement RootHandle (nolock)
              ON RootHandle.ElementHandle = ElementHandle.RootHandle
    JOIN ElementTypes ElementTypes (nolock)
              ON ElementTypes.ElementType = ElementHandle.ElementType
WHERE CAST(Sources.SourceText AS nvarchar(MAX)) LIKE '%code to search for%'
OPTION(MAXDOP 0)