Tuesday, December 30, 2014

Job to create a new Invent Dim

Occassionally you may need a code snippet to create invent dim if it didn't exist for the inventory transactions for the new combination. Just sharing to keep it as a knowledge base.

static void CreateInventDim(Args _args) //Create a new invent Dim
{
    InventDim   inventDim,inventDimFind;

    //Batch = 123459
    inventDim.clear();
    inventDim.inventLocationId = 'HOUSTON';
    inventDim.InventSiteId = 'CENTRAL';
    //inventDim.inventBatchId = “123459
    inventDimFind = inventDim::findOrCreate(InventDim);
    info(inventDimFind.inventDimId);

}

Tuesday, October 7, 2014

Dynamics AX Retail POS - Inventory lookup

We can view the stock levels of the Products directly from the Retail POS using the Inventory Lookup function. The function is applicable only for stock items and is a quick & easy way to check back the stock real time at Back office. To successfully view the stock levels make sure the following setups are configured correctly for the Store.
  1. Store inventory lookup option is checked
  2. Retail operating unit of the Store has a valid address 
  3. Atleast 1 Store locator group is defined
  4. Store is successfully published
  5. Product is linked to the assortment
  6. Product has a Physical Stock in On-Hand inventory
  7. Legal entity has Language and Address defined
To aid in additional checks, make sure the crt.Store view in the Retail Channel DB is able to show the Store correctly. If any you can view the joins to know all the related tables have been properly populated with data.


Retail POS Amount Decimal Places

Issue
I recently came across a scenario where the Retail POS suddenly started showing more than 2 decimal places. There are no changes in the Store or Retail configurations which could have triggered the sudden 3 decimal places to appear at the POS for the Amount fields. 



Resolution
I was aware that the currency plays an important part in the decimal and rounding places. After a while found that the Currency form's Rounding Rules, Prices field with 4 decimal places when changed will affect the prices in Retail POS. So after I reset it back to 0.0000 instead of 0.0010, the issue went away. After the change make sure to run the Currency job to sync the changes to POS, log off and log back in to see the new changes. The rounding should now have come back to 2 decimal places.


Friday, August 15, 2014

Retail POS does not show Price - No Channel Configuration was found

Issue: 
Dynamics AX Retail POS does not show Price for products added to sale. Also you will find an event log error as 'No Channel Configuration was found' with some stack trace.

Resolution:
The Retail POS is not able to find the Channel i.e Store information based on the data setup for the legal entity, a simple overlook on a few Legal entity setups can cause this issue and become an headache during the implementation. 
Dynamics AX Retail POS uses the Channel DB's CHANNELCONFIGURATIONVIEW to get the Channel.

If you can observe the joins in the View, it seems a simple assortment, price group and store setup is not sufficient to get the prices onto the Retail POS, you would need to setup the Legal entity properly.

To make it short, make sure you have entered the language, address in Legal entity and Retail Parameters defined. After iterating changes in the setup, run the view again to check if the Store channel is retrieved correctly in the query window. Then run the POS, with the View returning the relevant record the Retail POS should be able to compute the Product prices correctly using the Retail Pricing DLL's. You should now be able to make the product sale.

Actual View(For troubleshooting):
ALTER VIEW [crt].[CHANNELCONFIGURATIONVIEW] AS
(
SELECT
[rct].[RECID],
[rct].[CHANNELTYPE],
[rct].[INVENTLOCATION],
[rct].[INVENTLOCATIONDATAAREAID],
[rct].[CURRENCY],
[rct].[PRICEINCLUDESSALESTAX],
[l].ACCOUNTINGCURRENCY AS 'COMPANYCURRENCY',
[lpa].[COUNTRYREGIONID],
[lacr].[ISOCODE] AS 'COUNTRYREGIONISOCODE',
[rsp].[EXCHANGERATETYPE],
[rsp].[STAFFPASSWORDHASH],
[rsp].[TSPASSWORDENCRYPTION],
[rsp].[DEVICETOKENALGORITHM],
[rsp].[EARNLOYALTYOFFLINE],
[rtsp].[PROFILEID] AS 'TSPROFILEID',
[rtsp].[LANGUAGE] AS 'TSLANGUAGEID',
[rtsp].[TSSTAFF] AS 'TSSTAFFLOGONCONFIGURATION',
[rtsp].[CENTRALTABLESERVER] AS 'TSHOST',
[rtsp].[CENTRALTABLESERVERPORT] AS 'TSPORT',
[rtsp].[RETAILTSDATA] AS 'TSENCRYPTEDPASSWORD',
[rtsp].[SERVERCERTIFICATEDNS] AS 'TSSERVERCERTIFICATEDNS',
[rtsp].[SERVERSERVICENAME] AS 'TSSERVICENAME',
[rtsp].[PROTOCOL] AS 'TSPROTOCOL',
[rtsp].[SECURITYOFF] AS 'TSSECURITYOFF',
[rp].PICKUPDELIVERYMODECODE,
[rp].ELECTRONICDELIVERYMODECODE,
[rp].GIFTCARDITEM,
[rp].CANCELLATIONCHARGE,
[rp].CANCELLATIONCHARGECODE,
[rp].EXPIRATIONDATE AS 'QUOTEEXPIRATIONDAYS',
[rp].MINIMUMDEPOSITFORSALESORDER,
[rp].SHIPPINGCHARGECODE,
[rct].CHANNELTIMEZONEINFOID AS 'TIMEZONEINFOID',
[clv].LANGUAGEID AS 'DEFAULTLANGUAGEID',
[rsbp].[APIKEY] AS 'BINGAPIKEY',
[lpa].VALIDFROM,
[lpa].VALIDTO,
[crt].GETCATALOGIMAGEATTRIBUTEDEFAULTVALUE() AS CATALOGDEFAULTIMAGETEMPLATE,
[crt].GETEMPLOYEEIMAGEATTRIBUTEDEFAULTVALUE() AS EMPLOYEEDEFAULTIMAGETEMPLATE,
[crt].GETCUSTOMERIMAGEATTRIBUTEDEFAULTVALUE() AS CUSTOMERDEFAULTIMAGETEMPLATE
FROM [ax].RETAILCHANNELTABLE rct

-- Get transaction service profile information
INNER JOIN [ax].RETAILTRANSACTIONSERVICEPROFILE rtsp ON rct.TRANSACTIONSERVICEPROFILE = rtsp.PROFILEID

-- Get the store's country/region
INNER JOIN [ax].COMPANYINFO ci ON ci.DATAAREA = rct.INVENTLOCATIONDATAAREAID
INNER JOIN [ax].LEDGER l ON l.PRIMARYFORLEGALENTITY = ci.RECID
INNER JOIN [ax].DIRPARTYLOCATION drl ON drl.ISPRIMARY = 1 AND drl.PARTY = ci.RECID
INNER JOIN [ax].LOGISTICSPOSTALADDRESS lpa ON lpa.ISPRIVATE = 0 AND lpa.LOCATION = drl.LOCATION
INNER JOIN [ax].LOGISTICSADDRESSCOUNTRYREGION lacr ON lacr.COUNTRYREGIONID = lpa.COUNTRYREGIONID

-- Get the store's default language
INNER JOIN [crt].CHANNELLANGUAGESVIEW clv ON clv.CHANNEL = rct.RECID AND clv.ISDEFAULT = 1
INNER JOIN [ax].RETAILPARAMETERS rp ON rp.[KEY] = 0 AND rp.DATAAREAID = rct.INVENTLOCATIONDATAAREAID

CROSS JOIN [ax].RETAILSHAREDPARAMETERS rsp

LEFT JOIN [ax].RETAILSHAREDBINGPARAMETERS rsbp ON rsbp.[KEY] = 0
WHERE rsp.[KEY] = 0
)

Detailed Event Log:
LSRetailPosis.POSProcesses.ProcessInput: Microsoft.Dynamics.Commerce.Runtime.ConfigurationException: No channel configuration was found.
   at Microsoft.Dynamics.Commerce.Runtime.Data.ChannelDatabaseAccessor.GetChannelConfiguration(Int64 channelId)
   at Microsoft.Dynamics.Commerce.Runtime.Data.ChannelDataManager.GetChannelConfiguration(Int64 channelId)
   at Microsoft.Dynamics.Commerce.Runtime.CommerceRuntime.CreateRequestContext(Request request)
   at Microsoft.Dynamics.Retail.Pos.PriceService.Price.GetPrice(IRetailTransaction retailTransaction)
   at LSRetailPosis.BusinessLogic.ItemSystem.CalculatePriceDiscount(IPosTransaction transaction)
   at LSRetailPosis.BusinessLogic.ItemSystem.CalculatePriceTaxDiscount(IPosTransaction transaction)
   at LSRetailPosis.POSProcesses.ItemSale.Execute()
   at LSRetailPosis.POSProcesses.Operation.RunOperation()
   at LSRetailPosis.POSProcesses.ProcessInput.Execute().

Monday, August 11, 2014

Life Cycle Service(LCS) - Deployment of Development and Test Environments

Life cycle services has just released the August update, with a lot of new enhancements especially for Dynamics AX environments. For a full information on the release details please checkout the LCS blog. One of the most significant changes in the August release of LCS update was the release of new Pre-Built environments for Development or Testing and Retail specific environments for Pre-sales and internal development for Partners. This is a very interesting development as these steps pave the way for a fully featured Dynamics AX 2012 deployment fully on the cloud for Production environment. LCS in the past couple of years has taken significant initiatives to streamline partner concerns on assisting AX projects with Sure step methodologies, Business process, Project Issue tracking, Environment hosting, etc. In a way LCS is slowly moving from a passive roles to getting more active and engage the Partner and customers in the project deployments.

To access these new features, create a new Project or an existing one and Click on the Cloud hosted environments. It is assumed that you have downloaded the LCS certificate and uploaded it to the Azure Portal to let LCS manage it on your behalf (Configuring and Deploying VM's).


Choose the + button to create a new Deployment,


As you notice now you have a lot more Beta environments that are prebuilt in this update compared to previous LCS releases. The new options available in the August release are,
  1. Developer/Test
  2. Retail E-Commerce
  3. Retail Essentials
  4. Retail Essentials Demo
  5. Retail Mobility
I chose to deploy the Retail Essentials Demo environment on my Azure for performing some demo scenarios. Click on Next and then relax, let LCS do all the job of copy, deploy and provision the new Demo Environment. It will take a couple of hours to get all the things up, you should be able to see the Environment getting ready on Azure. To login use the connect button on Azure to RDP to the deployed server. The User name and password to login can be found under LCS > Project > Cloud hosted environments > Environment


Enjoy doing a demo or perform a test or simply trying out the new features in AX 2012 R3 on your new Environment in under an hour.


Thursday, August 7, 2014

AX 2012 Retail POS Task Recorder

Dynamics AX 2012 has a very good task recorder function which will record the user actions performed in AX client to create as a word document or recording video. The resulting document or video in the Recording file path can be used a manual or troubleshooting guide by the users. From my experience I literally use the Task recorder to create custom user guides which can be readily used by the customers. Dynamics AX 2012 has introduced a process oriented or simply to say "structured" way of doing a task recorder by bringing in the concepts of Framework, Industry and Hierarchy levels. These are completely definable by the author as in a way it is deemed necessary of arranging the document artifacts. Also the Framework and Industry helps to create a matrix which you can use to create multiple nodes based on the hierarchy levels. Let me now get back to this post where I want to just focus on the Task recorder of the Retail POS. Yes you heard it right, the Task recorder is extended and available in Retail POS also with the same Framework and Industry. The Rich client task recorder is pretty much straight forward as you can create some nodes and add the Recording path and straight away start doing the Task recording. 

There is pretty much NIL documentation(At least until the publication of this post) if you need to know anything on the Task recording for Retail POS and how to get it working as expected like the Rich client. There are some steps that you would need to do to make sure the Task recorder start button is enabled for Retail. 
First step is using the AX client make sure you have a Hierarchy and Industry created or available, and make sure for the Retail POS the Recording mode is selected as Basic. Under the Hierarchy levels create the sequences for atleast 3 levels, may be you can provide the Levels such as Process Group, Process, Task, etc. For reference you can check the Contoso demo data. Make sure you have enabled the Allow artifacts from Sequence 3 onwards, this is the feature that enables to link the document recordings to the Nodes.
 


Then make sure to run the Data distribution job 1170 to sync these values to the Channel database. Open retail POS using manager privilege and open the Task Recorder. If the operation is not available you can choose any button and add the operation from the button properties if Design change on POS is allowed.

Choose your Framework and Industry, the New node should be enabled. Add the new node until the level where allow artifacts is enabled as shown in the above Hierarchy levels. Make sure to check the recording path is already available on the Setup.


Now do your start recording just as you would on the AX Client, after done stop and your document should be prepared with all the screenshots and steps just the way you want it.




Saturday, August 2, 2014

Dynamics AX 2012 Retail Loyalty Points Earnings are not updated Realtime from POS

Recently I came across an issue where the Retail Loyalty transactions are not updated real time back to the AX HQ. All the settings for Loyalty Programs, Schemes, Tiers and Cards were set correctly but the points update was elusive and we had no idea why it was not getting updated. When the same settings were done in an another environment it was working as expected, so we were quite sure there was some issue that was localized to the Retail POS, but not sure why it was happening.
Finally the resolution was a simple one, just Closing and Opening a New shift did the trick. It seems the settings even though are fully pushed to the POS, the loyalty specific settings was not used until and unless the worker had closed the shift. Then after this operation all the Loyalty points update was back to normal just as expected.

Please do note, if your Loyalty earnings are setup to process offline. Then they wont be updated real time that means the points shown is as of last processing of offline loyalty transactions. So the drawback is that the points cannot be used for redemption immediately. But the redemption transaction is realtime that means when the points are redeemed it is updated realtime back to HQ based on the balance points that he already has in his card.


Saturday, July 12, 2014

System security permissions for the domain user installing AX 2012

The domain user who is installing or configuring the AX 2012 components requires specific permissions or roles for the servers and server components. While the System Administrator will always frown when we request for certain administrator privileges for install. Now the AX support has published a detailed permissions which can be submitted to the system admin for the installer to work. However it doesn't cover much on the Retail components but nevertheless the concept applies the same to them too.

For the complete details please take a look at the AX Support site here.

Saturday, June 21, 2014

Mysterious issue of missing R3 Retail "Active price" in Retail Product Pricing

Dynamics AX 2012 R3 Retail HQ you will be able to see the Store specific pricing for each of the products. The form can be accessed either from Stores or Products from the Retail ribbon bar. The Retail price list form consolidates the details from various sources like assortment, product pricing and Trade agreements. So it can be "laggy" when you open the form if you have lots of products or stores.



There are various columns for price and discounts, my focus at this time is on the column "Active price". It is supposed to show the final product price after computing from the trade agreements if any or just the base sales price. But in my application it was showing as Zero, even if I had an appropriate trade agreement applicable for the Product. 

Deeper investigation reveals that the actual pricing is computed by the PricingEngine dll from Reference assembly Microsoft.Dynamics.Commerce.Runtime and which is inturn handled by the DLL Microsoft.Dynamics.Commerce.Runtime.Services.PricingEngine.dll from the RetailPricingEngine class. It always broke without error during the invocation of the dll function. Was wondering why it was breaking exactly at this point. While I checked and compared with another environment that was working as expected for price computation. Compared the DLL size/modified date/contents and it seemed everything was same except the calculation was not showing correctly.

Finally after an exhaustive search(coincidentally Retail POS was also not showing correct product prices which prompted for a detailed function call by call trace) found the issue on the HQ was due to simple setting at the AOS. Due to the back and forth hot swapping of assemblies between the client and server, bringing my Debugger in between crashed the DLL function call of pricing engine. I was hoping for a decent error or warning to indicate something wrong with the dll but it just ended quietly without triggering any messages. So I disabled my hot swapping of assemblies at the AOS and restarted the AOS service. Active prices came back and the Pricing Engine DLL did its job as expected to return the exact prices which would be seen in the Retail POS.



An interesting point to note is both the HQ and the POS use the same Pricing Engine DLL to get the product price for the store with all other parameters included for consideration. So if you see the Product price in the HQ pricing form, it is guaranteed to be same on the POS price window(conditional discounts, promotions, etc not applicable) for a unit of that product.


Dynamics AX 2012 R3 Retail - Install Async Client - Things to Note

A couple of things to note to check for the installation of the Async Client

1. AsyncServer - Installed and configured properly
You should receive a IIS webserver reply(Contents are not configured to be listed - 403 Error) when you visit the URL(https://FullyQualifiedServerName:Port/ASyncServer/) from the browser from the Machine that you want to install the Async Client

2. Create Channel Database - In Microsoft Dynamics AX create the Channel Database from Retail > Setup > Retail Scheduler > Channel Database and follow the details in the MSDN help for the Form fields
Do a Full Meta Data Sync from Retail Scheduler Parameters, this is to create a an entry in the Async Server DB that the new Channel DB is configured at the HQ
Make sure the DB name is the AsyncServerHQMsgDB

3. User Name & Password - Provide the user name and password for the Async Client to execute on the local machine.

4. Server Certificate - Make sure to export the Server certificate that was provided for the Async Server from the MMC console( MMC > Add snap-in console > Certificates), also import on the ASyncClient machine using the MMC(Normal install certificate is not enough) to Trusted Root Certification Authority in Local computer




AX 2012 R3 Retail POS Error - Microsoft.SqlServer.Types Error - System cannot find the file specified

Issue
You might come across this error when you deploy a standard R3 POS while performing an operation for Getting Product Price, or Adding New Customer, etc essentially any operation that involves sending limited commands to the POS Store DB on another server from the POS machine.




Reason:
On certain occasions you might have a centralized Store DB which is used by all the POS machines and you would not need a offline DB(SQL Express) because you are absolutely sure that the network is always on for the POS. But still the POS requires a minimum of feature pack components for all the operations dll that does DML operations on the store DB.

Some of the impact of these missing SQL components are unable to create new customer(Write to Store DB ) or Calculate Product prices (Pricing Engine) will return zero price.

Resolution:
If you already have a SQL server express then all the necessary components are already covered else the minimum two components of the SQL Server feature pack - SharedManagementObjects.msi and SQLSysCLRTypes.msi

Restart your POS and your Microsoft.SqlServer.Types error will no longer occur and you should be able to see the R3 Retail functionality to work as expected. Hope the post solves someone issue.


Detailed Error Message:

LSRetailPosis.POSProcesses.ProcessInput: System.IO.FileNotFoundException: Could not load file or assembly

'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its

dependencies. The system cannot find the file specified.
File name: 'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity,

RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean

forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity,

RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean

forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity,

RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean

forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at System.Data.SqlClient.SqlConnection.ResolveTypeAssembly(AssemblyName asmRef, Boolean throwOnError)
   at System.Data.SqlClient.SqlConnection.<>c__DisplayClass19.<CheckGetExtendedUDTInfo>b__17(AssemblyName asmRef)
   at System.TypeNameParser.ResolveAssembly(String asmName, Func`2 assemblyResolver, Boolean throwOnError, StackCrawlMark&

stackMark)
   at System.TypeNameParser.ConstructType(Func`2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError, Boolean

ignoreCase, StackCrawlMark& stackMark)
   at System.TypeNameParser.GetType(String typeName, Func`2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError,

Boolean ignoreCase, StackCrawlMark& stackMark)
   at System.Type.GetType(String typeName, Func`2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError)
   at System.Data.SqlClient.SqlConnection.CheckGetExtendedUDTInfo(SqlMetaDataPriv metaData, Boolean fThrow)
   at System.Data.SqlClient.SqlDataReader.GetValueFromSqlBufferInternal(SqlBuffer data, _SqlMetaData metaData)
   at System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32 i)
   at System.Data.SqlClient.SqlDataReader.GetValue(Int32 i)
   at Microsoft.Dynamics.Commerce.Runtime.DataModel.CommerceEntity.Populate(SqlDataReader sqlDataReader, TimeZoneInfo

timeZoneInfo)
   at Microsoft.Dynamics.Commerce.Runtime.Data.DatabaseAccessor.ExecuteReader[T](SqlPagedQuery query)
   at Microsoft.Dynamics.Commerce.Runtime.Data.DatabaseAccessor.ExecuteSelect[T](SqlPagedQuery query)
   at Microsoft.Dynamics.Commerce.Runtime.Data.ChannelDatabaseAccessor.GetStoreById(Int64 channelId)
   at Microsoft.Dynamics.Commerce.Runtime.Data.ChannelDataManager.GetStoreById(Int64 channelId)
   at Microsoft.Dynamics.Commerce.Runtime.CommerceRuntime.CreateRequestContext(Request request)
   at Microsoft.Dynamics.Retail.Pos.PriceService.Price.GetPrice(IRetailTransaction retailTransaction)
   at LSRetailPosis.BusinessLogic.ItemSystem.CalculatePriceDiscount(IPosTransaction transaction)
   at LSRetailPosis.BusinessLogic.ItemSystem.CalculatePriceTaxDiscount(IPosTransaction transaction)
   at LSRetailPosis.POSProcesses.ItemSale.Execute()
   at LSRetailPosis.POSProcesses.Operation.RunOperation()
   at LSRetailPosis.POSProcesses.ProcessInput.Execute()

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].
.


Issue



Friday, May 23, 2014

Dynamics AX 2012 R3 Demo VM Launched

Dynamics AX 2012 R3 Demo VM has finally been launched featuring fully loaded demo data and instantiated application. This is the first release for R3 as the previous releases were mainly CTP demo versions which are actually WIP preview releases for R3.
The VM can be easily downloaded from both Partnersource and Customersource, and there are tons of materials both documents, videos and blog posts for trying out the new functionality incorporated in AX 2012 R3 expecially on the Retail, Wax &Trax, Mobile etc. Microsoft has improved a lot on the documentation front with these additions compared to the previous version releases.
For those who have active Azure subscriptions, the demoVM is available in just a few clicks via the Life cycle services portal, without the need for complicated disk and ram requirements to run the demo VM.
Here is the link for Partnersource to download the Demo VM

Tuesday, May 6, 2014

Dynamics AX 2012 R3 is now live!

Dynamics AX 2012 R3 is now in GA mode, you can now easily download it from both Customersource and Partnersource.

Every new release has brought lots of expectations about the changes and R3 is no different. For the starters, AX 2012 R3 can be hosted on Azure in addition to on-premise, which means the product can be officially hosted on the cloud and clients can access it via internet.
Most of the functionality changes seems to be on the improvements of the existing modules or verticals. The changes are mainly highlighted on the Retail, Warehouse and Transportation management and full integration with SCOM for application monitoring.

On the Retail vertical front I noted,
Architecture change in the data transfer between the Retail Stores and HQ. The R3 version works as WCF hosted on IIS, which allows for greater scalability than previous versions as a windows service. And A-jobs has been replaced by SQL change tracking, needing to eliminate the A-jobs from AX side.

From Retail functionality wise - Kits, advanced discounts and loyalty is much improved in the new version.

For the complete list, please take a look at the Getting started with AX 2012 R3 which has direct links to Technet and MSDN for detailed information on each of the release details.


Monday, April 7, 2014

Modify the System fields in a Table

The system fields in Dynamics AX are the CreatedBy, ModifiedBy, Created Date Time, Modified Date Time, Partition, DataareaId, RecId, these fields are not directly modifiable by the users as they are auto generated during insert and update operations. If in any case you are doing a migration or would need to capture some relevant user id or created/modified date time you can still do it. Here is how,

First inform the kernel and as proper permission for the OverwriteSystemfieldsPermission.assert() and then activate the relevant table's overwriteSystemFieldsmethod - True to indicate these tables system fields values will be provided, however for the values that you don't provided the system will still populate with the default values. To refer to the fields use the tables field id's rather than the intellisense field name. Update remaining business column values and then insert the record. Make sure to set back the overwriteSystemFields method - False to revert to the settings. 

So the sample code would look like this.

Table      sampleTable;

ttsbegin;

new OverwriteSystemFieldsPermission().assert();
sampleTable.clear();
sampleTable.overwriteSystemFields(True);
sampleTable.(fieldNum(Table, CreatedBy) = 'DM-Admin'; //User id - If possible get from SysUserInfo table
sampleTable.(fieldNum(Table, ...othersystemFields)) = //Use appropirate assignment for the system fields
sampleTable.NormalColumns = //Your normal business column values
sampleTable.insert();
sampleTable.overwriteSystemFields(false);

CodeAccessPermission::revertAssert();

ttscommit;


Wednesday, March 12, 2014

SQL Error: String or Binary data would be truncated

Issue: SQL error during Insertion of records to a custom table
"String or Binary data would be truncated" and the SQL insert command is shown in the error infolog.

Description:
The issue will occur only if you have modified the field column length of a table after the records are created in Dynamics AX. When you are trying to insert the records, even though your data is within the column length, the existing rows might be inconsistent with the new data inserted. No synchronization errors are shown but the error will be only upon insert.

Resolution:
Delete the affected column and recreate the column with the correct length, impact existing data might be lost. Make sure to evaluate the issue's pro's and con's before actually deleting the columns and as a Golden rule always always backup the Database/Table before any columns are deleted. You don't want to have nasty surprises or abnormal behaviors after the deletion.


SSRS Reports Performance boost!

We always not matter how the code is optimized there is always a complaint from the user that the reports are slow from their perspective, especially if they run the reports the first time. The performance is much better though when the report is re-run again, as we say it the SSRS has warmed up to service the report requests. So it is exactly what has been incorporated in the 2012 R2 CU7 and above, there is a new report "warm up" class called the SSRSReportServerWarmup.
The warm up class will connect and load the AX assemblies to reporting server cache which cuts up a lot of time when the users will actually run the report. However you would still need to run this class as a batch job after the Reporting server restart to get the performance gain.
The best thing about the class is it is extendable and you would be able to even run up specific reports to further the performance improvements in loading and caching the assemblies before the user actually runs the report. Please do read up on the extensibility and SSRSReportServerWarmup class at the TechNet and the AX support site

Do incorporate and demonstrate to the client on the performance gains made in the SSRS report loading if they have any complaints!

Wednesday, February 19, 2014

WinAPI::ShellExecute() for a JAR file for Banking application

Recently came across a scenario where a banking a hash program needs to be called to encrypt a payment file before sending to the Bank. The bank had just changed the hashing program from an .exe file to a .cmd, this file inturn was a batch script file which would validate and then call a JAR file with the appropriate parameters.
Issue:- While executing the .cmd file from the Command prompt the JAR file runs and hashes the file correctly, but when we use the Dynamics AX to call the .cmd file the JAR file is not executed. The command used was WINAPI::ShellExecute(Command, Parameters);

Investigation :- After preliminary checking from both the AX and command prompt we guessed that the .cmd file was not being executed due to a failure in the calling mechanism. We tried different approaches by calling the cmd.exe and then pass the parameters to mimick the manual approach. But somehow the command prompt opened up but did not execute the JAR file. Then next approach was to add all the commands inside a batch script file which would call the JAR file, so from AX we wouldn't need to specify the details in AX but would just call the batch script file. Still the execution of JAR file from AX was not happening even though we could execute the file manually.
After a lots of Google searches on the execution environment with ample trial and error my colleague identified that the issue was due to JRE execution is the root cause. Meaning that Dynamics AX looks for the Java Runtime under the 32 bit folder(under C:\Program Files (x86)\Java\bin) instead of the 64 bit installed in Windows server 2012 machine. This could be because of the legacy run time approach followed since the older versions executing the JAR files.

Conclusion:-
Install the 32 bit Java runtime on the server.

Notes:
AX job would look something like this to call the WINAPI::ShellExecute(command); where the command = @D:\TestScript.bat

And test script  batch file will have,
CD D:\HashFile\
D:\HashFile\HashProgram.cmd parm1 parm2 parm3 parmx....
Another thing to note is to link the batch file to the folder using CD D:\HashFile\ before executing the .cmd file. To point to the correct execution folder before running the command.


Add on:- For those who are trying to execute exe as a process from X++, do find an excellent post from Bo Jensen at his blog post - X++ run a process with user credentials



Thursday, February 13, 2014

Publish-AXReport : SSRS Deployment Error 'Domain/User' is not recognized

I faced this issue during deployment of all the default SSRS report when I was migrating the application from Development environment to UAT. The issue occurs due the previous AOS sessions that are present in the Table SysServerSessions table. This table will not be listed in the AOT and you will be able to access this table for viewing the records from SQL management studio, alternatively you can also create a dummy form and access the table from datasource.

There is no problem in deleting the records in this table as the records are automatically inserted by the AOS when AOS service starts up. 

Conclusion:- Turn off the AOS and clear the records from SysServerSessions table. Republish the SSRS reports it'll publish correctly.


Wednesday, February 12, 2014

Report Deployment Error - Value cannot be null. Parameter name : explicitConfiguration

Today faced an SSRS error when deploying on of the reports in our client environment on AX 2012 R2 CU6

The error is exactly similiar to the issue described in this blog. Please refer for the error event log and the detailed description about the WCF service artifacts failure.

Conclusion: Fix the endpoint or deactivate the failed service group and re-try the report deployment again.


Dynamics AX 2012 R3 Training Blitz

Dynamics AX 2012 R3 is just around the corner, and is planned for GA by May 2014.

There some initiatives from the Microsoft Product team for familiarizing the product before GA. Some of the avenues are Technical & Product Conferences and Microsoft Connect for CTP. Recently there are some very public R3 Training Blitz webcasts for showcasing what can be expected in the new release. The webcasts are free and can be joined by everyone, during the conference the team diligently answers the questions from the viewers. Also the first webcast for the R3 is recorded and out on the Youtube which is a great way to reach out to all those who would have missed it.

The second sessions are planned for Feb 26 and Feb 27, please do join in as it has specific segments for the verticals including Retail & Manufacturing. I am very interested and keen to know the new things that are being implemented in the R3 Retail after seeing some of the significant changes in the CTP sessions.
Here is the link for you to join the Dynamics AX virtual events, do signup and enjoy the sessions.

Just incase if you have missed the Part 1 of the Traning blitz webcast, catch it on Youtube here.