Quantcast
Channel: Dynamics AX
Viewing all 550 articles
Browse latest View live

AX2012 – Compare model. When you put in hotfixes, updates and want to do less – Part 1

$
0
0
via Tamás Mészáros

So you got updated Model(s) or hotfix(es) and need to make sure your ISV or VAR or CUS / USR layer code has been merged.

Lets see what your options are:

  1. Create a project for each model and then compare then to the upper layers for changes.
    — You spend a lot of time giving yourself carpal syndrome
  2. Auto code upgrade
    — It only manages hotfixes. The code that needs to be manually reviewed can be overwhelming? (someone please correct me on that)
  3. You write some script to find out how to do this
  4. Magic beans
    — You don’t get them

Ok, so I wrote some SQL scripts to do this, however it was getting too complex for me and I knew I could do it faster with in memory processing with C#. Although I can argue with myself that SQL can do a better job with this. However, I went to the path of C#

Tables used:

  1. SysElementType – This stores what a node in the AOT is classified as. E.g. TableInstance, ClassInstanceMethod, BaseEnum. This is purely to translate an integer to a human readable value.
  2. SysModelElement – This is where the definition of each object is. So every node in the AOT is one record here. This record also links it to the Parent Element. So a record which is the table field, will have its parent element to the Table itself. A parent element can have another parent element too, e.g. a form element inside a group
  3. SysModelElementData – This is where the code for the SysModelElement is stored. And it it stored for each Model (not layer). Moment I override the code in the USR layer for the SalesFormLetter classdeclaration in Ax, it will create a record in this table with the new code. So use it as a caution, if you ever query this table, be careful because you could be transferring a “lot” of data across the wire

Combining SysModelElementData, i can find what all other models use the same element. Then link it up to sysModelElement and find more information about the AOT object that has changed.

Armed with this knowledge I went and created  C# console application

The project currently compares models. So if you want to know what has affected the VAR and USR layer models with the addition of a particular SYP layer model, then you send the list of SYP model id’s and then the list of VAR and USR layer models as a csv string. This does a fast compare and outputs what objects you need to look at.

The shortcomings / bugs of this so far:

  1. Security, menu items dont get compared because of the way this is stored
  2. Currently you need to compare models. I would like to say i need to know what objects are affected by these SYP models and then get a list of objects on all the higher layers
  3. Need to create a library instead of a console project

This project is posted on GitHub: https://github.com/shashisadasivan/AxCodeCompare.git


Filed under: Ax 2012, Dynamics Ax Tagged: AX2012, AxAdministration

RecId number sequence maintenance table in AX

$
0
0

SystemSequences is the table maintaing the every table next RecId sequence value.

Number sequence 0 does not exists while Time sheet posting in Dynamics ax R3

$
0
0

 

After recent upgrade from Dynamics ax 2012 RTM version to R3 I found problem in posting the timesheet and the error was “Number sequence 0 does not exists” This error is not so obvious. After bit of debugging I came to know that Time sheet voucher number sequence is missing. Strange thing is that I am not seeing this Number sequence in Project parameters also. I did check projectTimeSheet configuration key also which needs to be enabled for timesheet. In my cake config key was enabled.

After bit of research I cam to know that Time sheet voucher sequence is new from R2. Previously hour jour was used to post the time sheet.

Untitled

To make this number sequence appear in the project parameters I have to reload it. I created a simple job below to do this work. After running this job the new hidden number sequence start appearing.

Later Number sequence wizard was run to populate the value of sequence.

static void jobName(Args _args)

{

   NumberSeqModuleProject NumberSeqModuleProject = new NumberSeqModuleProject();

   ;

   NumberSeqModuleProject.load();

}


Small job that helps you update the Customer address book association

$
0
0
1:  static void UpdateAddressBookOfCustomer(Args _args) {  
2:      CustTable custTable; //= CustTable::find("2104");  
3:      container addressBooks = ["ALL", "CEU", "CEC"];  
4:      while select firstonly Party from custTable {  
5:          DirAddressBookParty::createPartyRelationsByName(custTable.Party, addressBooks);  
6:      }  
7:  }  

Happy Daxing :)


Update order header through AIF

$
0
0

The following code sample shows how to update an existing order through AIF from outside Dynamics AX 2012 . Scenario is the we need to update some of the fields at header of Order.

 public static int UpdatePurchaseOrder(string _purchId, CallContext CallContextObj = null)  
     {  
       try  
       {  
         KeyField keyField = new KeyField() { Field = "PurchId", Value = _purchId };  
         EntityKey entityKey = new EntityKey();  
         entityKey.KeyData = new KeyField[1] { keyField };  
         EntityKey[] entityKeys = new EntityKey[1] { entityKey };  
         if (CallContextObj == null)  
         {  
           CallContextObj = CallContextSettings.getCallContextObject();  
         }  
         using (ANPurchOrderServiceClient client = new ANPurchOrderServiceClient())  
         {  
           client.ClientCredentials.Windows.ClientCredential.Domain = CredentialsSettings.Domain;  
           client.ClientCredentials.Windows.ClientCredential.UserName = CredentialsSettings.UserName;  
           client.ClientCredentials.Windows.ClientCredential.Password = CredentialsSettings.Password;  
           AxdANPurchOrder PurchaseOrderDoc = client.read(null, entityKeys);  
           AxdEntity_PurchTable purchTable = PurchaseOrderDoc.PurchTable.First();  
           purchTable.ANPublishedState = AxdEnum_ANPublishedState.Published;  
           purchTable.ANPublishedStateSpecified = true;  
           purchTable.action = AxdEnum_AxdEntityAction.update;  
           purchTable.actionSpecified = true;  
           purchTable.PurchLine = null;  
           // Invoke the update operation  
           AxdANPurchOrder newOrder = new AxdANPurchOrder()  
           {  
             PurchTable = new[] { purchTable }  
           };  
           client.update(CallContextObj, entityKeys, newOrder);  
           return 1;  
         }  
       }  
       catch (Exception ex)  
       {  
         Console.WriteLine(ex.ToString());  
       }   
       return 0;  
     }  

With above code we did as per need, read the purchase order document through read operation, set some fields and last set actions also. when I try to test the application I got some funny strange error

“Invalid entity action.”

This error confuse me also, as I have set the action also. After some research I came to know that read operation of service is returning both header and lines also, which I don’t need that for my scenario. So the fix is that I need to set the line object to null also and then send for update operation.

purchTable.PurchLine = null;

Question after this fix came In my mind is that can we only read header or specific line through read operation ? I will research about this more. If anyone knows this please share your thoughts with me. THANKS


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

$
0
0

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  

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

$
0
0

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


Tutorial: Caching display methods

$
0
0

Overview

Caching is an important part of the Microsoft Dynamics AX application. It allows us to significantly speed up certain processes by avoiding redundant round trips to the server and the database. Display/Edit methods are a good example of where caching is helpful, as it significantly increases the overall responsiveness of a form.
In AX 2012 R3 there are a number of ways you can specify that a display method needs to be cached. Below is a list, as well as a brief description and an xpo with a tutorial form to show the various options.
  • Invoke cacheAddMethod(MethodName) in the init() method of the data source
This is the only option that was available in older versions of Dynamics AX.
All cached data methods are calculated and cached in executeQuery of the data source they belong to. That is why it is important to call the above method in the init() of the data source, once the data source is initialized, but the data hasn't been retrieved yet. The optional second parameter controls whether or not the display method value should be refreshed when data is written to DB
  • Add the SysClientCacheDataMethodAttribute attribute on the display method
Now that attributes are available, caching a display method is as easy as adding an attribute on the method. It has an optional parameter same as the above method. Note, that marking a display method with this attribute will mean that it is cached on all forms the method is used on. So make sure that is what you want to happen before adding it.
  • Set the “Cache data method” property on the display method form control to Yes
This is, again, a new capability in the latest version of AX, that is pretty much identical to calling the cacheAddMethod, just much easier.
  • Set the “Cache data method” property on the display method form control to Auto, where the data source is read-only
Now, this is something that is done automatically by the kernel. If the data source which the display method belongs too is read-only, and Cache data method property on the corresponding control is set to Auto, the kernel will cache this method. This is smart, as the value can’t really change. You can still change the property to No, if there’s a reason why you want the display method not to be cached.

Additional info

On top of the above, I would also like to mention a few other things.

  • There are 2 kernel-defined methods, called titleFields and parentTitleFields, which are always being cached automatically by the kernel. The titleFields method corresponds to the 2 Title Fields that you can set on the table level. Then, if you have this table as your TitleDatasource on the form design, the 2 fields selected will be shown in the caption of the form. parentTitleFields is very similar, only it displays the title fields of the parent data source table, which is relevant in a header-lines (dynalinked datasources) kind of scenario. As a fallback, it shows the titleFields.
  • There are methods for managing the cached methods, one of them being cacheCalculateMethod, which asks the server to re-calculate the method value and update the cache for the current record. Note that it will only take effect if the method has previously been cached. In the tutorial project I am using this method in the form method runHack to refresh the value of 2 of the display methods. 

Example

You can download the xpo project with the tutorial from my OneDrive.
Upon opening the form in the project, some data will be pulled into the form. More specifically, the first 3 items/customers/vendors/sites/warehouses. For each of them a display method is present, and one of the above approaches is used to cache it.

Step 1



None of the display methods are cached. As you can see, nothing extra was done in executeQuery of the main data source, but itemName was cached for all 3 records for the read-only data source, as the control has "Cache data method" property set to Auto. This happens even though the tab page is not the active one, so it wasn't really yet necessary to calculate these values. Maybe the user won't even navigate to that tab page. You should consider this carefully when designing a form, and always aim at increasing the overall responsiveness of a form by only executing the appropriate display methods.

Step 2 and 3



inventSiteName and vendName were cached (through one of the options above). As you can see, now their values are calculated once for each of the records shown. InventLocationName and custName are still not cached.
Clicking on Refresh result button will show any extra calls to the display methods since the form started. As you’ll quickly notice, the non-cached methods are being called every time something hints at covering up the value of the control, or rather every time AX thinks it needs to recalculate the value, which is VERY OFTEN. That should make it pretty clear how useful caching is for display methods.

Step 4



Now inventLocationName was also cached, and the only method that is remaining and not cached is custName. You can see how more and more methods are executed in one batch on the server as part of the executeQuery method on the data source.

Step 5



As the last step, I have added 2 standalone controls that show the Title fields of the main data source table, and started logging the time method caption is invoked. As I have written above, titleFields and parentTitleFields are cached automatically, but you can't really see it, as it is not possible to override it. caption is the closest you can get to it, so I figured it's worth showing that. You can see the method is evaluated right after all data source queries have executed (as it relies on the currently selected record). It is evaluated first time based on the selected data source record, and then again when focus actually goes to the grid, so that the first record is explicitly selected. It will be invoked again whenever the active record changes. Note that unlike custName method, it does not get constantly refreshed.

Play around with the form and let me know if you have any questions or comments.
Thanks


AX 2012 Install Model – A Checklist

$
0
0

This is a checklist I follow to install Models Provided for a installed site

  1. Stop the AOS
  2. Backup the Database
  3. Install models (follow guidelines, you may be told to use the overwrite option)
  4. Merge Code (optional)
    1. Start AOS
    2. Merge Code
    3. Stop AOS
  5. Compile X++
    1. Option 1 – AxBuild.exe (RU7 and Onwards)
      1. Make sure AOS is turned off
    2. Option 2
      1. Start AOS
      2. Open Ax Client
      3. Compile
      4. Stop AOS
  6. Compile CIL
    1. Start AOS
    2. Open Ax Client
    3. Run Full CIL Compile
  7. Restart AOS
  8. Synchronize database
  9. Restart AOS

If you do restore a Live database over the TEST database, make sure to transfer the parameters as well as reset the SYSSQMSettings.GlobalGUID


Filed under: Uncategorized

Error in “Go to origin” — Alert rules notifications

$
0
0

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


Open a file using X++ code in windows like xml or Excel

$
0
0
static void WindosFile_Open(Args _args)
{
;
WinAPI::shellExecute("D:\\Bank statement1.xlsx");
}

DefaultDimension and default financial dimension values through X++ code in AX 2012

$
0
0
Using the dimension values getting default dimension recid:
Example 1.
static void dimension(Args _args)
{
DefaultDimensionView defaultDimensionView,defaultDimensionView1;
VendInvoiceTrans vendInvoiceTrans;

while select defaultDimensionView join vendInvoiceTrans
where vendInvoiceTrans.DefaultDimension == defaultDimensionView.DefaultDimension
&& defaultDimensionView.name == "CostCode"
&& defaultDimensionView.DisplayValue == "DX001"
join defaultDimensionView1
where defaultDimensionView1.DefaultDimension == vendInvoiceTrans.DefaultDimension
&& defaultDimensionView1.Name == "Project"
&& defaultDimensionView1.DisplayValue == "TIPL-000044"
{
info(strfmt("%1 %2 ",defaultDimensionView.DisplayValue,vendInvoiceTrans.InvoiceId));

}

}
=============
Using Defult dimension getting Dimension values: Example 1:

ProjTable ProjTable;
DimensionAttributeValueSet DimensionAttributeValueSet;
DimensionAttributeValueSetItem DimensionAttributeValueSetItem;
DimensionAttributeValue DimensionAttributeValue;
DimensionAttribute DimensionAttribute;

while select * from ProjTable
where ProjTable.ProjId == "70001" // To get 70001 dimension values
join RecId from DimensionAttributeValueSet
where DimensionAttributeValueSet.RecId == ProjTable.DefaultDimension
join RecId, DisplayValue from DimensionAttributeValueSetItem
where DimensionAttributeValueSetItem.DimensionAttributeValueSet == DimensionAttributeValueSet.RecId
join RecId from DimensionAttributeValue
where DimensionAttributeValue.RecId == DimensionAttributeValueSetItem.DimensionAttributeValue
join RecId, Name from DimensionAttribute
where DimensionAttribute.RecId == DimensionAttributeValue.DimensionAttribute
{
info(DimensionAttribute.Name+"----"+ DimensionAttributeValueSetItem.DisplayValue);
}


===============


DimensionAttributeValueSetStorage dimStorage;
ProjTable ProjTable;
Counter i;

ProjTable = ProjTable::find("70001"); // To get 70001 dimension values
dimStorage = DimensionAttributeValueSetStorage::find(ProjTable.DefaultDimension);

for (i=1 ; i<= dimStorage.elements() ; i++) { info(DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name +"----" +dimStorage.getDisplayValueByIndex(i)); } ============= ProjTable ProjTable; Counter i; container conDim; ProjTable = ProjTable::find("70001"); // To get the dimension values for 70001 conDim = AxdDimensionUtil::getDimensionAttributeValueSetValue(ProjTable.DefaultDimension);

for (i=1 ; i<= conLen(conDim) ; i++)
{
info(conPeek(conDim,i));
}

AX hang up and deadlock when opening general journal and Invoice journal Can not create number sequence in Ax 2009 and AX 2012

$
0
0
I have faced a issue is that when I am creating General journal or Invoice journal system getting hang up and deadlock.
So I found that Number sequence issue, system is unable create number sequence since that number is already generated and Available in NumberSequence-> List

I was trying to delete unused number sequence list no use, there are 2 table to have a look.

NumberSequenceTable
NumberSequenceList


I have tried to delete in table also no Use. Even cant delte unused number sequence list in DB side.


SOlution:

Step.1 Stop AOS.
Step 2 Take DB back up.
Step 3 Delete the unused NumberSequence from NumberSequencList table in the SQL server DB side.
Step 4 Start AOS.

Happy Daxing :-)

How to uninstall Windows Internal database for Windows Sharepoint Services 3.0

$
0
0
Greetings All!

It's been a while since I was last here. I was away for a while to meet some personal commitments and also my work life kept me busy.

I would like to share a recent experience where I had to troubleshoot a WSS 3.0 installation where it was using Windows Internal database instead of SQL

I found this technet article helpful to uninstall Windows Internal database

 https://technet.microsoft.com/en-us/library/cc708610(v=ws.10).aspx

Hope it might help somebody out there!

Dynamics AX 2012 R3 CU9 is available


Book Review - Dynamics AX 2012 R3 Development Cookbook

$
0
0
Dear Friends,

Hope you are having a good time.

Thanks to Velinda from Packt Publishing for providing me with yet another copy of cookbook for review.

Introduction

Microsoft Dynamics AX 2012 R3 Development Cookbook is a handy and a must have book for any developer who is working on AX 2012 R3. It provides with practical scenarios which a developer comes across in his/her day to day work.






About the Author

Mindaugas Pociusis currently a freelance Dynamics AX technical and functional consultant and trainer at DynamicsLab Limited (www.dynamicslab.com). 

He is a Certified Microsoft Trainer for Dynamics AX and has delivered numerous Dynamics AX trainings.Mindaugas has participated in over 20 Dynamics AX implementations. He has held a wide range of development, consulting, and lead roles while always maintaining the significant role of a business application developer.
In December 2009, he released his first book, Microsoft Dynamics AX 2009 Development Cookbook, and then in May 2012, its second edition, Microsoft Dynamics AX 2012 Development Cookbook, both of which are published by Packt Publishing.

In order to obtain a copy of the book, please visit this link


Book Chapters

This book covers the following chapters

Chapter 1 - Processing Data

This chapter covers various scenarios like creating number sequence, merging records, renaming primary key, Executing Direct SQL Statement, Import/Export data from XML file, Building query objects.

Chapter 2 - Working with Forms

This chapter covers topics like using a tree control, Building a checklist form, Creating dialogs using the Runbase framework, Building a dynamic form through code etc

Chapter 3 - Working with Data in Forms

This chapter explains how to create custom filter control, preload images, create a wizard, processing multiple records, Adding image to records.

Chapter 4 - Building Lookups

This chapter is all about lookups - creating a lookup dynamically, using a form to build a lookup, Building a tree lookup and so on.

Chapter 5 - Processing Business Tasks

This chapter walks through various application scenarios like using segmented journal entry control, creating a general journal, posting a general journal, Processing Project Journal, Creating and Posting a Ledger Voucher, Creating and Posting Purchase Order, Creating and Posting Sales Order.

Chapter 6 - Integration with Microsoft Office

This chapter briefs on the various integration scenarios with Microsoft Office Products

Chapter 7 - Using Services

This chapter is all about creating and extending services (AIF and custom services) in Dynamics AX

Chapter 8 - Improving Development Efficiency

This chapter is about building extensions for Code Editor and Personalization forms

Chapter 9 - Improving Dynamics AX Performance

This chapter demonstrates the tools used to troubleshoot AX Performance like Dynamics AX Trace Parser, Calculating code execution time, Using SQL Server Database Engine Tuning Advisor.

Overall, a good book with plenty of code snippets which can be used on a daily basis.

How to get meaningful AIF messages on Web service consumer?

$
0
0

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;
            }


Troubleshoot Dynamics AX 2012 AIF Error The deployment web site was not found for the port

$
0
0
I was working on a custom service which I needed to activate on HTTP adapter, however was constantly hitting on this error while activating the service

Error - The deployment web site was not found for port


Fix -

The solution was to remove the end slash (\) from the service uri

System Administration > Setup > AIF > Website

Before: http://localhost:85/MicrosoftDynamicsAXAif60\

After: http://localhost:85/MicrosoftDynamicsAXAif60



I followed this blog which helped me to fix the issue
http://axaptapeople.blogspot.com.au/2013/11/ax2012-aif-known-issues.html



Troubleshooting IIS WCF Service Error Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format

$
0
0
Greetings!

In one of my Ax/Biztalk/Oracle integration projects, I had to write a web service to retrieve data from Oracle and as part of that development, I was using the Enterprise Library from Microsoft, On my development box, the build was good and my VS project compiles successfully without any issues.

However, while hosting the webservice on IIS 8.0 (Windows Server 2012)  and trying to browse from the internet explorer, I got this error below:

Error:

Server Error in '/' Application.


Could not load file or assembly 'Framework.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.BadImageFormatException: Could not load file or assembly 'Framework.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Framework.Data' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stack Trace:

[BadImageFormatException: Could not load file or assembly 'Framework.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +210
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +242
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +17
   System.Reflection.Assembly.Load(String assemblyString) +35
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +122

[ConfigurationErrorsException: Could not load file or assembly 'Framework.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +12480704
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +499
   System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +131
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +331
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +148
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +172
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151

[HttpException (0x80004005): Could not load file or assembly 'Framework.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12601936
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159


Solution:

After some troubleshooting, found the fix is to set Enable 32-bit Application = True on the App Pool which is used by the webservice. This solved the problem.









Copy records to multiple companies / Insert records to multiple companies in AX 2009/2012

$
0
0
static void InsertRecordsInCompanies( Args _args )
{
ProjTable projTable,_projTable;
Str com;
DataArea dataArea;
;

com = curext();

while select _projTable
where _projTable.CheckCompany == Noyes::Yes
{
while select dataArea
where dataArea.id != curext()
&& dataArea.id != "dat"
{
changeCompany( dataArea.id )
{
if(dataArea.id != com)
{
projTable = null;
projTable.ProjId = _projTable.ProjId;
info(strfmt("%1,%2 %3",projTable.ProjId,_projTable.dataAreaId,projTable.dataAreaId));
}
}
}
}

}
Viewing all 550 articles
Browse latest View live