Pages

November 16, 2015

Use one table for creating multiple relation

Hi Folks,
After a long time I’m writing this new post.
Requirement: I need to use the single table to add multiple relation on a table. For eg. I have a parent table Table1 with field ItemId and ProcessItem. Now I need to add relation to InventTable to both fields. Hence I have to create two relation with InventTable.

How to do: Add two new relation in your table as shown below.

image
You might get an error message after this,
'RelatedTableRole' conflicts with another 'RelatedTableRole' on relation InventTable_Item on table ProcessedItemTable.
image
Solution to this error:
Set below two properties to each relation
1. UseDefaultRoleNames- set it to “NO”
2. Role: Give any logical name here, for eg. “Item”

image
image
Now compile your table, error must gone.
Write your any query/feedback in comment box and help us to improve. Thanks..!!!
-Harry

October 11, 2015

Third time in a row.......

Hi All, 

I would like to share this golden moment with you all, Again I’m awarded by Microsoft as Most Valuable Professional (MVP) this year as well.
It's the third time in a row when I recognized by Microsoft for Dynamics AX. 

Thanks to each of you for your guidance and support.   


Old Post:

-Deepak Agarwal aka Harry 

Follow us on Facebook to keep in rhythm with us. @Facebook https://www.facebook.com/theaxapta


September 15, 2015

DIXF error [AX2012 CU8]


Issue: While Open Processing Group (Data import export framework/Area page/Common/Processing Group), system throws below error message.

Could not load file or assembly 'Microsoft.Dynamics.AX.Framework.Tools.DMF.PreviewGrid, Version=6.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

image

Possible reason:

After a fresh installation of AX, we have DIXF as a module but we need to install additional component as well to use DIXF.
In this case we need to install DIXF client services from installation media.

Solution:





Install DIXF client services from AX setup and restart the AOS services.
image

Keep sharing your feedback as comment…..

Related post:
DIXF Error- Assembly containing type
-Harry

September 13, 2015

How to Export/Import Label files in AX 2012

Label are pretty different in AX2012 instead of earlier version of AX. Here is quick steps to import and export Label files from one Environment to other. You also perform an update on label files.
Export a Label file:
Open AOT, Expend Label node. Choose Label and require language to export. You can do it for individual language or you can select multiple language all in once.
image
Exported file will save on selected path with extension “.ald”.
Import Label File:
Right click on Label node in AOT and select “Create from File”, choose ald file to import than hit create.
image

image

Update a Label file:
Import the new updated label file system will ask to overwrite , go ahead
image
It will update your existing Label file.
Note: You must run full Synch after every import/Update.
More info: https://technet.microsoft.com/en-us/library/gg731886.aspx
-Harry

August 26, 2015

Date manipulation through X++ code [AX 2012]

Hi Folks,

I come though a requirement where I need to manipulate on “FromDate” and “ToDate”. When user enter these value through a dialog box, user can select any day from month for eg.

From Date: June 6, 2015
To Date: August 20, 2015

image

And to perform some action on Financial stuff we may need to consider the whole month like
from June 1, 2015 to August 31, 2015

You can fetch this month range in your x++ code, here is a sample code, try it…
static void theAxapta_MonthRange(Args _args)
{
    DialogField                     dialogStartDate, dialogEndDate;
    Dialog                          dialog = new Dialog("Month range");
    TransDate                       fromDate, todate;

    dialogStartDate = dialog.addField(extendedTypeStr(TransDate));
    dialogEndDate   = dialog.addField(extendedTypeStr(TransDate));
   
    dialogStartDate.label("From Date");
    dialogEndDate.label("To Date");
   
    if(dialog.run())
    {
        fromDate = mkDate(1, mthOfYr(dialogStartDate.value()), year(dialogStartDate.value()));
        toDate   = (mkDate(1, (mthOfYr(dialogEndDate.value()) + 1), year(dialogEndDate.value())) - 1);
       
       
        info(strFmt("Start Month %1", fromDate));
        info(strFmt("End Month %1", todate));
    }
}


Output:

image

In case of any suggestion and query, feel free to drop as a comment.

-Harry

July 04, 2015

AX7 aka Rainier , The most awaited version of Dynamics AX

Hi Folks,
Very soon we all are going to meet with AX7, by the end of this year it must be out in market. Initially this is going to be cloud only, with Azure you need LCS account to deploy this on cloud. In this version MS going to introduce many major/minor changes in their product like
- Initially there is on premises deployment, only cloud is the only option.  
- Development will happen in Visual studio only. (I guess we need the ultimate version only)
- New AOT design
- Totally web based UI, no rich client.
- No more life for Enterprise portal.
I will keep you posted about the updates on AX7.
Thanks-
Harry

-Harry Follow us on Facebook to keep in rhythm with us. @Facebook https://www.facebook.com/theaxapta

June 22, 2015

Restore the DB, showing DB in use

Hi Folks,

Recently I was facing some issue while restoring AX database, whenever I try to restore the Transactional DB its show error "DB is use" while actually this DB is not used anywhere. Than I try to take take the database offline, But again there was one other issue.
Same issue again DB offline taking very long time.
I tried below steps and this worked for me. :)
Step 1: Try to run below two queries in same given sequence.
i. ALTER DATABASE <DBNAME> SET OFFLINE WITH ROLLBACK IMMEDIATE
ii. ALTER DATABASE <DBNAME> SET Offline
Step 2: Now try to take offline manually.
clip_image001
Step 3: Restore the DB.
Step 4: Some time after doing restoration/backup DB will not work.
Than u need to roll back above query operation
ALTER DATABASE <DBNAME> SET online WITH ROLLBACK IMMEDIATE
ALTER DATABASE <DBNAME> SET online.
Related Post:
AX DB restoration: Database goes into “Restoring” state for long
-Harry

June 14, 2015

Dynamics AX 2012 R3, CU9 is out in market.

Hi Folks,

Finally CU9 is released this week.
Here is some more details about this Cumulative update.

New Highlights

1. Introduced new features into HR, Transportation Management,Warehouse Management and Retails modules.
2. Many county-specific regions updates including US, UK, INDIA, Poland, Belgium, Brazil, Europe, Germany, India, Italy, Lithuania, Mexico, Netherlands, Russia, Spain, Austria and Poland

General Information
1. Installation Guide
2. What’s new in CU9
3. Build No: 6.3.2000.326
    Kernel: 6.3.2000.326

Download Option:
1. From LCS
2. From Partner/Customer resource

- Harry

June 08, 2015

AX DB restoration: Databsae goes into “Restoring” state for long



While restoring the AX DB , after completion of this process respective DB stuck into “Restoring” state
image

You need to run below query to fix this.
RESTORE DATABASE [DataBase Name] WITH RECOVERY

-Harry

June 01, 2015

Error with Windows live writer and blogger

Hi Guys,

I was facing some error using Windows live writer, every time I tried to access my blog account on live writer is showing below error message

Blogger Returned the following error:
NotFount: Not Found



It seems some technical issue is there at Micsoft/Google side, we need to wait for a solution.

Below is some useful links on this ongoing issue, (Still waiting for any solution from either Microsoft or Google itself)

https://productforums.google.com/forum/#!topic/blogger/-49FC2_0l-g

https://social.microsoft.com/Forums/en-US/379fab33-5008-442d-9869-a7357aacbeb0/problem-with-blogger-notfound-not-found?forum=writergeneral

-Harry 
 Follow us on Facebook to keep in rhythm with us. @Facebook https://www.facebook.com/theaxapta

Error while Confirming PO, and in Sales Order

Hi Folks,

After applying one HotFix, I got many weird issues, some are mentioned below

1. I wasn't able to confirm any Purchase Order
2.Not able to proceed Sales order to Warehouse.
3.While packing slip of Sales Order, I am getting many lines of different sales order.

Below error message bother me every time.



Solution:
All you need to do, unmark the below check box from





Now all above error message must not come again.
To do this for all user in one shot, use below job to do it. 

static void theAxaptaUpdate(Args _args)
{
    UserInfo        UserInfo;
    update_recordSet UserInfo
    setting
    debugInfo = 1036
    where UserInfo.debugInfo == 12;
}

-Harry

Follow us on facebook to keep in  rhythm with us. @Facebook

May 28, 2015

Copy AX DB from one domain to other domain

Hi Folks,

Many time we need to restore one Database to another system which is not part of current domain. In such cases its not going to be straight forward to click on restore button on SQL. You need to perform some other action to make it work. 
  Use below steps to restore AX DB from a different Domain.

1. Restore DB using SQL management studio.
2. Edit UserInfo table in SSMS (SQL server management Studio).
you need to update the SID and domain. To find current system user SID use below steps.
SID of current system user:
Run below command in Command prompt.
whoami /user
image

You can also copy if from Registry
Type RegEdit in run command



3. Open SSMS, open AX database-> Tables -> SysUserInfo

Update below field in 
i. UserId
ii. Domain
iii. SID

4. Now start AOS services and open ax client. It should work.

-Harry

May 19, 2015

Error: Fields are not visible in Form while added in table and field group

Issue: I added below fields in a new table (I picked from DirPartyTable, yes we prefer to copy new fields from other table ;) )
1. FirstName
2. Middle Name
3. Last Name
While i add the same in a Form these fields are not visible at all.

Possible reason:
In DirPartyTable  the configuration key for all above fields is set to “SysDeletedObjects60”, also these fields are prefixed “DEL”  that means these fields may deprecated in next version on AX.
image

Solution:
Here is very simple solution, Just remove the configuration key from YOUR NEW table fields(don’t play with DirPartyTable, do it in your new table).
than synch table and restore your form. Now check all fields should visible on form.
Also you can have a look on table “DirPersonName”. Here you will found the same fields.

- Harry

May 11, 2015

Error while table synch

Error: While doing Synchronization system throw below error

SQL error description: [Microsoft][SQL Server Native Client 11.0][SQL Server]Error: The new name '' is already in use as a COLUMN name and would cause a duplicate that is not permitted.

Solution: I am not very much sure it is the right way or not, but by doing this this error will remove.

Export this table and delete from your customized layer. Now Synch this table and restore.

Now import you code again, this error must remove.


If you have any better solution for this issue, plz let me know or put you comments on our FB page
www.fb.com/theaxapta

-Harry

May 05, 2015

Error while Unit Testing [AX 2012 R3]

Hi All,
I was facing below error while running test cases for a customization. 


  • An internal error occurred in the remove operation in the SysTestRecordCleanUp#Context object cache.
  • A critical error has occurred in function SysTestRecordCleanUp::cleanUpContext.
  • An error has occurred. Contact your administrator for further assistance.

  • clip_image001 
    Solution: However i am not very much sure why this error was coming and what is the main reason for this, but I used below steps and its resolved this issue.
    1. Stop to AOS
    2. Delete AUC files from below path.
    3. Restart AOS.
    Try now, it should work fine.
    image
    -Harry

    April 26, 2015

    How to delete AUC files

    During many development we face some cache related issues. There is no error in code and still changes are not reflecting. Even after performing CIL, Compile and Sych but issue still existing. All these are happened due to ax_{GUID}.auc files. We need to clear(delete) these files from Appdata folder.
    To delete AUC(Application Unicode Cache) files we need to perform below steps.
    1. Stop AOS
    2. Delete AUC files from below path
    C:\Users\<UserId>\AppData\Local
    image
    3. Restart AOS.
    PS: AOS restart is not mandatory. Its better to do it in this way however it will work without AOS restart.
    More details on AUC
    -Harry

    April 20, 2015

    How to send Email through X++ code

    Hi All,

    Use below code to sent emails from X++ code. Below code is written in a Job you can reuse the same in your logic. 

    static void dpk_TestEmail(Args _args)
    {
        // Set these variables.
        str                                   sender = “sender@dnaitservices.com”;
        str                                   recipient = 'rcpt@dnaitservices.com';
        str                                   cc = 'cc@dnaitservices.com';
        str                                   subject = 'TheAxapta_Subject';
        str                                   body = 'TheAxapta_Msg';
        str                                   fileName = @'D:\test.txt';
        List                                  toList;
        List                                  ccList;
        ListEnumerator                        le;
        Set                                   permissionSet;
        System.Exception                      e;
        str                                   mailServer;
        int                                   mailServerPort;
        System.Net.Mail.SmtpClient            mailClient;
        System.Net.Mail.MailMessage           mailMessage;
        System.Net.Mail.MailAddress           mailFrom;
        System.Net.Mail.MailAddress           mailTo;
        System.Net.Mail.MailAddressCollection mailToCollection;
        System.Net.Mail.MailAddressCollection mailCCCollection;
        System.Net.Mail.AttachmentCollection  mailAttachementCollection;
        System.Net.Mail.Attachment            mailAttachment;
        ;
        try
        {
            toList = strSplit(recipient, ';');
            ccList = strSplit(cc, ';');
            permissionSet = new Set(Types::Class);
            permissionSet.add(new InteropPermission(InteropKind::ClrInterop));
            permissionSet.add(new FileIOPermission(filename, 'rw'));
            CodeAccessPermission::assertMultiple(permissionSet);
            mailServer = SysEmaiLParameters::find(false).SMTPRelayServerName;
            mailServerPort = SysEmaiLParameters::find(false).SMTPPortNumber;
            mailClient = new System.Net.Mail.SmtpClient(mailServer, mailServerPort);
            le = toList.getEnumerator();
            le.moveNext();
            mailFrom = new System.Net.Mail.MailAddress(sender);
            mailTo  = new System.Net.Mail.MailAddress(strLTrim(strRTrim(le.current())));
            mailMessage = new System.Net.Mail.MailMessage(mailFrom, mailTo);
            mailToCollection = mailMessage.get_To();
            while (le.moveNext())
            {
                mailToCollection.Add(strLTrim(strRTrim(le.current())));
            }
            le = ccList.getEnumerator();
            mailCCCollection = mailMessage.get_CC();
            while (le.moveNext())
            {
                mailCCCollection.Add(strLTrim(strRTrim(le.current())));
            }
            mailMessage.set_Priority(System.Net.Mail.MailPriority::High);
            mailMessage.set_Subject(subject);
            mailMessage.set_Body(body);
            mailAttachementCollection = mailMessage.get_Attachments();
            mailAttachment = new System.Net.Mail.Attachment(fileName);
            mailAttachementCollection.Add(mailAttachment);
            mailClient.Send(mailMessage);
            mailMessage.Dispose();
            CodeAccessPermission::revertAssert();
            info("Email sent.");
        }
        catch (Exception::CLRError)
        {
            e = ClrInterop::getLastException();
            while (e)
            {
                info(e.get_Message());
                e = e.get_InnerException();
            }
            CodeAccessPermission::revertAssert();
        }
    }

    -Harry

    April 13, 2015

    System trade line number increment is not specified.

    Hi Friends,

    I faced one Error while creating Purchase Order from Approved Purchase Requisition
    Error Message:
    System trade line number increment is not specified.
    Purchase order creation has been cancelled due to errors

    clip_image001

    Reason: As mentioned in error message there is one parameter missing.'

    Possible Solution:Click on “System Parameter” from infolog window or go to
    System administration -> Setup -> System Parameter
    Under System Line Number, Change the increment from 0 to 1.

    clip_image002

    Now try again to create PO.

    clip_image003

    Double click on purchase order number to open PO from.

    - Harry

    April 08, 2015

    How to deploy Dynamics AX instance on Azure through LifeCycle Service (LCS)- Part II

    Hi All,

    In my previous post we discussed how to configure your Azure account with LCS services and how upload LifecycleServicesDeployment certification on Azure portal.
    In this post i will show you how to deploy the AX using LCS on Azure.
    Step: 1 Login into your LCS account, select the project you want to deploy. Go to environment and click on ‘+’ symbol

    image

    In next screen you need to choose topology to deply.
    DEMO: for demo purpose
    DEVTEST: For development or testing
    Here we will use DEMO topology, click on DEMO
    image ‘'

    On next screen you need to choose Product version. Click on “Demo AX 2012 R3 CU8”
    image

    On the next screen give a name for this instance. (You can select a different size). Click on next.
    image

    It will ask for a confirmation for deployment. Click on deploy.
    Now LCS will deploy the environment on Azure, this may take some time to complete this step.
    image


    Now on right side tile click on VM Name “DEMO####”
    image

    It will download a RDC file. Save this file and open with user name and Password.
    image

    Your Cloud VM is ready for use.
    - Harry

    April 01, 2015

    New book released Microsoft Dynamics AX 2012 R3 Reporting Cookbook

    Hi Folks,
    I am very happy to share with all of you that my new book just released in market.
    Microsoft Dynamics AX 2012 R3 Reporting Cookbook
    image

    This book is recommended for Dynamics AX developers and .NET-based SSRS developers looking to familiarize themselves with the new AX reporting framework.
    This book contain 10 chapters 

    1: UNDERSTANDING AND CREATING SIMPLE SSRS REPORTS
    2: ENHANCING YOUR REPORT – VISUALIZATION AND INTERACTION
    3: REPORT PROGRAMMING MODEL
    4: REPORT PROGRAMMING MODEL – RDP
    5: INTEGRATING EXTERNAL DATASOURCES
    6: BEYOND TABULAR REPORTS
    7: UPGRADING AND ANALYZING REPORTS
    8: TROUBLESHOOTING AND OTHER ADVANCED RECIPES
    9: DEVELOPING REPORTS WITH COMPLEX DATABASES
    10: UNIT TEST CLASS AND BEST PRACTICES USED FOR REPORTS

    For details check on web stores to get your copy.
    - Harry

    March 27, 2015

    Auto Settlement of Sales Invoice in AX

    In an organization where thousands (or more) of sales transaction happening every day, and here is this auto settlement requirement comes in picture. Auto settlement process save a ton of time to manually settlement of each and every customer or record. There are three different ways to perform a auto settlement of the sales invoices.

    1. By Sales parameter select auto settlement.
    2. By select open transaction at the time of invoice posting
    3. Through X++ code

    1. By Sales parameter select auto settlement: Go to AR/Setup/Parameter under settlement tab you will found a check box for automatic settlement. Select this check box. And your system will auto settle your sales invoice.
    clip_image002

    This will settle a transaction whenever you post a payment journal.

    2. By select open transaction at the time of invoice posting: You can also choose the open transaction at the time of invoice journal creation. At the time of invoicing click on “open transaction settle” button, this will open a new form to select records to be settle from open transaction of that customer.


    clip_image004

    clip_image006

    3. Finally we have code as well (I love this part ;)): So here we are to do some tricky things. Yes, we can do the settlement by X++ code as well. Below code is an example in Job. You can use the same logic for any trigger point in AX.

    static void theAxapta_AutosettlePayment(Args _args)
    {
    CustTable custTable;
    CustTrans invCustTrans, payCustTrans;
    SpecTransManager manager;
    CustVendTransData custVendTransData;
    ;
    custTable = CustTable::find("504411");
    // Find the oldest unsettled invoice
    select firstonly invCustTrans
    order by TransDate asc
    where invCustTrans.AccountNum == custTable.AccountNum &&
    invCustTrans.TransType == LedgerTransType::Sales &&
    !invCustTrans.closed;
    // Find the oldest unsettled payment
    select firstonly payCustTrans
    order by TransDate asc
    where payCustTrans.AccountNum == custTable.AccountNum &&
    payCustTrans.TransType == LedgerTransType::Payment &&
    !payCustTrans.closed;
    ttsbegin;
    // Create an object of the CustVendTransData class with the invoice transaction as parameter
    custVendTransData = CustVendTransData::construct(invCustTrans);
    // Mark it for settlement
    custVendTransData.markForSettlement(CustTable);
    // Create an object of the CustVendTransData class with the payment transaction as parameter
    custVendTransData = CustVendTransData::construct(payCustTrans);
    //mark it for settlement
    custVendTransData.markForSettlement(CustTable);
    ttscommit;
    // Settle all marked transactions
    if(CustTrans::settleTransact(custTable, null, true,
    SettleDatePrinc::DaysDate, systemdateget()))
    info("Transactions settled");
    }

    Enjoy…..

    - Harry

    March 23, 2015

    How to deploy Dynamics AX instance on Azure through LifeCycle Service (LCS)- Part I

     
    Hi All,
    In this post I will demonstrate how to configure your Azure account  with LCS(LifeCycle services) project to deploy the AX on Azure cloud.
    In second part of this post I will share how to actual deploy the AX on Azure.
    Here is quick steps to setup/configuration your Azure with LifeCycle services
    Step 1: Login you LCS services
    Step 2: Create a new project or you can use any existing project as well. Here in this tutorial I will take an example with new instance creation.
    clip_image001
    Click on + button and fill the details and click on create.
    clip_image002
    After create a new project below screen will come which shows, your project created successfully.
    clip_image003
    Step 2: Now click on Microsoft Azure setting under environments
    clip_image004'
    To proceed further you need you Azure subscription id. To find your subscription id Login into your Azure management portal.  Scroll down click on setting and copy from here
    clip_image005
    Paste this Subscription id in below field
    clip_image006
    Step: 3 Download management certification (file name : LifecycleServicesDeployment.cer)
    This certificate will enable Lifecycle Services to communicate with Azure on your behalf. Download this management certificate to your local computer. Then, upload the management certificate to the Azure management portal (Settings > Management Certificates).
    To  upload this certification Login into your Azure management portal.  Scroll down click on setting click on Management Certificate than click on “Upload Management certification”
    clip_image007
    Upload the “LifecycleServicesDeployment.cer” file here.
    Step :4 Now on LCS window click on next and select Azure region and click on “Connect”.
    clip_image008 '
    So here we completed the setup of LCS with Azure.
    In my next post i will share how to deploy the AX on windows Azure environment. How to host AX on cloud.
    - Harry

    March 19, 2015

    Completed 200 posts today.

    Hi Friends,

    Today I completed my 200 posts. This cant be possible without your support and feedback. 
    A big thanks to all of you.

    Regards-
    Harry

    Workflow setup in AX2012 R3 CU8

    Hi Folks,

    Here is the steps to setup the workflow in CU8. To setup workflow for first time, we need to setup it first.

    1. First of all we need a batch group which can handle the workflow triggers and proceed workflow task, also send the the notification to users.
     Go to System admin-> Setup -> Batch Group
    Add a new batch group for workflow,

    clip_image001

    Add batch server accordingly.
    clip_image002

    2. Now we need to setup the workflow parameters 
    Go to System Admin -> Setup -> workflow -> Workflow parameter
    image  

    Select workflow email template. (You may need to create a new workflow Email template)
    clip_image003

    3. Go to System Admin -> Setup -> workflow -> click on Workflow infrastructure Configuration
    Now a wizard will open and Follow below steps
    clip_image005

    4. Configure the workflow message processing batch job
    Select Batch group in below screen. (This may be not editable if already some records exists in respective tables)
    clip_image007

    5. Configure the workflow due date processing batch job
    On next screen select same batch group and enter the number of hours for recurrence interval
    clip_image009

    6. Configure the line-item workflow notification batch job
    In this screen we need to select a batch group and the number of minutes for recurrence interval of this job
    clip_image011

    7. As next screen you will have below screen to finish this process
    clip_image013

    So…. Now your system is ready for workflow process.

    -Harry