Wednesday, May 22, 2013

13 Common ERP Mistakes on implementation and How to Avoid Making Them

Implementing an ERP system is among the most expensive, time-consuming and complicated tasks an IT department can take on. The potential for delays and unexpected expenses lurk around every corner. To help you avoid costly mistakes, CIO.com asked IT executives, ERP vendors and technology consultants to provide advice on how to avoid becoming an ERP horror story.

Article has been taken from CIO website and I found it is much interesting and helpful to all of us.I took only the points but details are available in the main site. Please click here for complete details from CIO site.

ERP Mistakes
#1: Poor planning
#2: Not properly vetting ERP vendors
#3: Not understanding or using key features
#4: Underestimating the time and resources required
#5: Not having the right people on the team from the start
#6: Not setting priorities
#7: Not investing in training and change management
#8: Underestimating the importance of accurate data
#9: Taking the kitchen sink approach
#10: Not decommissioning legacy applications
#11: Not having an active load testing environment
#12: Ignoring third-party support alternatives
#13: Not having a maintenance strategy

Wednesday, April 17, 2013

Configure Microsoft Dynamics AX Connector for Mobile Applications

Microsoft has published a whitepaper of how to configure an environment that is running Microsoft Dynamics AX 2012 so that users can connect the Microsoft Dynamics AX mobile phone application. Please find below the for the white paper. 
Happy DAXing :)

Tuesday, April 16, 2013

Dynamics AX 2012 - X++ code to create & post General Journal

static void Raj_Demo_CreateGLJournalPost(Args _args)
{
    AxLedgerJournalTable    journalTable;
    AxLedgerJournalTrans    journalTrans;
    container               acctPattern;
    container               offSetAcctPattern;
    LedgerJournalTable      ledgerJournalTable;
    ledgerJournalCheckPost  ledgerJournalCheckPost;
    ;

    journalTable = new AxLedgerJournalTable();
    journalTrans = new AxLedgerJournalTrans();

    //Journal Name
    journalTable.parmJournalName("GenJrn");
    journalTable.save();

    journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);
    journalTrans.parmTransDate(systemDateGet());
    journalTrans.parmCurrencyCode("USD");
    journalTrans.parmAmountCurDebit(200);
   
    journalTrans.parmAccountType(LedgerJournalACType::Ledger);
    acctPattern = ["211345-Disp","211345", 2, "Department","00000014", "CostCenter", "00000007"];
    journalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(acctPattern));       
   
    journalTrans.parmOffsetAccountType(LedgerJournalACType:: Ledger );
    offSetAcctPattern = ["401100-Disp","401100", 4, "Department","00000014", "CostCenter", "00000007", "CustomPurposeA","Nile", "CustomPurposeB", "Site2" ];    
    journalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId( offSetAcctPattern));   
   
    journalTrans.save();   
   
    ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(journalTable.ledgerJournalTable(),NoYes::Yes);
    ledgerJournalCheckPost.run();  
   

    info(strFmt("Journal No. %1.", journalTable.ledgerJournalTable().JournalNum));
}

Find mandatory fields in a table

static void Raj_MandatoryFieldsOnTable(Args _args)
{
    DictTable dictTable;
    DictField dictField;
    int i;
    TableId tableId = tablenum(CustTable);
    ;
   
    dictTable = new DictTable(tableId);

    for (i=1 ; i<=dictTable.fieldCnt() ; i++)
    {
        dictField = new DictField(tableId, dictTable.fieldCnt2Id(i));
        if (dictField.mandatory())
        {
            info(dictField.name());
        }
    }
}

How to create and implement of surrogate keys in Ax2012

This post is a quick walk-through of how to create & implement of a surrogate key in a table in Ax 2012. Below example is a basic concept of creation and implementation of surrogate key in the table and the form.

Before we start there are few of terms you need to understand first:
·         Natural key. Think of this as the primary key that makes the most sense. eg CustTable.AccountNum and InventTable.ItemID. We can ignore the effect of DataAreaID for non-shared tables for now.
·         Surrogate key. The surrogate key in database terms refers to a field that also uniquely identifies a record, but isn't a natural selector. When looking at Ax, this is the RecID. In other systems this could be a sequential number, or GUID. Typcially, it's something created by the database itself, like an identity column, however in Ax it's managed by the kernel.
·         Primary key. The unique primary key should point to either the natural key, or the surrogate key.
·         Clustered index. This affects the physical layout of records in the database. This doesn't have any real functional impact, but you do need to be very careful when selecting the clustered index as it can have a serious effect on performance if setup incorrectly.
     Process:

     a.     Create two tables i.e. parentTable and child table along with the fields. Take “AccountNum” field is the primary key field in the table.
Figure 1: Parent Table structure
Figure 2: Parent table properties
Figure 3: Index properties

b.     Create an EDT with INT64 as datatype and select the “ParentTable” as table in “Refference Table” field under the EDT propery.
Figure 4: EDT
Figure 5: EDT Properties

c.     Drag the EDT into the child table and then system will ask “Do you want to add the ForeignKey relation from the EDT to the current table?” and your selection will be “Yes

       
d.  After completing above process you will find one index and a relation has been added in the child table.


    e.   Check whether your created surrogate key is created successfully or not
           a.        Enter few data in the Master table and then open child table.
           b.        Try to create new record in the child table
           c.        In the “SurrogateAcctNum” filed you will find a drop down like below. If you don’t find any dropdown like below then your process has not done in a right manner.
 
    f.   Create a form with the help of “ChildTable” and select the drop down of “AccountNum” field from the form control. Your drop down will look like below.



In the form control (under a form) you will see the original value of the record but if you go to the table and there you will find a recId (instead of value) in the field of the corresponding record.

Happy DAXing…

Random String for Dynamics Password



Get random string password by using “RandomGenerate” class

static void Raj_Password_Random()
{
    int i;
    RandomGenerate random = new RandomGenerate();
    str password;
    int passwordLength = 8
    ;

    for (i=1; i<= max(2, passwordLength); i++)
    {
        if (i mod 2)
            password += num2char(random.randomInt(char2num('a', 1), char2num('z', 1)));
        else
            password += num2char(random.randomInt(char2num('0', 1), char2num('9', 1)));
    }

    info(password);
}

Tuesday, January 4, 2011

Workflow configuration error in Dynamics Ax: 401 Unauthorized

If you are getting an error after installing Dynamics AX Workflow: “401 Unauthorized” after running Workflow infrastructure configuration wizard (Dynamics AX –> Administration –> Setup) at the first time installation of Dynamics Ax then you should go through the following steps…. It is mainly happening when database, AOS, Application and workflow servers are individual (especially workflow & AOS and Database server)
  1. Check AOS Service is running under an active domain user (domain\username)
  2. Workflow website and workflow application pool are having the same .NET Business Connector user name Identity (and of course, this should be an active domain user)
  3. You added the workflow website (http://servername:portnumber/DynamicsAXWorkflow50 for example) to the trusted sites in Internet Options of AOS server
  4. Run the following on the Workflow server:
  • After checking above points and then perform the following steps
Ø       Start a command prompt.
Ø       Locate and then change to the directory that contains the Adsutil.vbs file. (By default, this directory is C:\Inetpub\Adminscripts.)
Ø       Type the following command, and then press ENTER:
                          cscript adsutil.vbs set w3svc/NTAuthenticationProviders “NTLM”

     Ø To verify that the NtAuthenticationProviders metabase property is set to NTLM, type the following command, and then press ENTER:

                  cscript adsutil.vbs get w3svc/NTAuthenticationProviders

The output:
NTAuthenticationProviders       : (STRING) "NTLM"

 After completing above procedure successfully then please take a restart of Ax and IIS service and then workflow infrastructure configuration wizard will work fine.

Wednesday, December 15, 2010

Sending mail from workflow submit or Approve or any status in Dynamics Ax

During some period we are trying to send email from Ax while a workflow is submitted, approve or reject and etc. to the employee by using standard Ax procedure. But we did not achieve full our goal by using standard procedure. After few R&Ds we found that the standard Ax provides only can send a fixed email which is defined in E-mail template. Same mail has been sent to the user in case of workflow submit or approval or reject or anything. It is a standard template which is using in Ax.
Our requirement was different mail will go as per the workflow status. I found all the information are stored in the "Event Inbox" table. So I made a batch job class with necessary procedures and it is running into batch job after very little bit of customizations.

Customization:
1. One field is added into the "EventInbox" table: TMSendEmail (EDT: NoYesId)
 It would indicate email is sent or not. Once email sent then it will ticked.
2. Created a class with extends "RunBaseBatch"
 It prepares the email and send while batch occurrence in called

Procedure:
1. Set email id required employees those are tagged user in workflow
2. Check the email Notification field (under Approval & Task notification group)
   Administrator -> User -> User Option -> Notification (Tab)

Operations:
1. Find the class xpo and import it. Change the necessaries as per your requirements.
2. Run the class -> a dialog will open -> Select Batch Process -> click Recurrence
3. Set no "No End Date" and set recurring pattern to Minute in "1" under count filed
4. Click Ok to back
5. Put a caption and select a batch group from the Batch Group field then press OK.
Class automatically fall into batch job and it will call 1 every minute. You can find the batch job under Basic -> Enquiries -> Batch Job.
Here while the batch is call called then run method of class would call and corresponding methods will be executed.

Sending of mail to the user is depends upon the workflow configuration. Body, Subject, users all are to be set into the configuration.

I made it in this way if anyone have any idea or comment or suggestions then please don’t forget to share with me.

Monday, December 13, 2010

Enable workflow in a Dynamics Ax webpart (EP)


First create a new dynamics webpart in .net. Need to perform few steps to enable the workflow in the required webpart.
a.  Register workflow control in webpart.
    <%@ Register Assembly="Microsoft.Dynamics.Framework.Portal, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="Microsoft.Dynamics.Framework.Portal.UI.WebControls.Workflow" TagPrefix="dynamics" %>
b.  Add workflow control in webpart (place the code after datasource).
    <dynamics:AxWorkflowActionBar ID="WorkflowActionBar" runat="server" DataSourceID="AxDataSource1" DataMember="{TableName}_Current" />
C.  Under Editor, call the following namespace
   using Microsoft.Dynamics.Framework.Portal.UI.WebControls.Workflow;
d.  Create the following method for calling CanSubmitToWorkflow method by using Proxy.
   void WorkflowActionBar_EvaluatingCanSubmitToWorkflow(object sender, EvaluatingCanSubmitToWorkflowEventArgs e)
         {
            Boolean canSubmit;
            IAxaptaRecordAdapter record = e.DocumentRecord;
ApplicationProxy.TM_PolicyMaster policyMaster = new                     ApplicationProxy.PolicyMaster(this.AxSession.AxaptaAdapter, record);
        canSubmit = (Boolean)policyMaster.canSubmitToWorkflow();

        e.CanSubmitToWorkflow = canSubmit;
   }
      (Note: Here PolicyMaster the Ax Table and canSubmitToWorkflow method is under the table and it is defined in proxy also. It returns boolean)
 e.  Create or update the page init method in webpart editor with following code
     void Page_Init(object sender, EventArgs e
     {       
          this.WorkflowActionBar.EvaluatingCanSubmitToWorkflow += new EventHandler<EvaluatingCanSubmitToWorkflowEventArgs>(WorkflowActionBar_EvaluatingCanSubmitToWorkflow);
      }
f.  Create three WebActionMenuItems in DAX with EPWorkflowWorkItemActionManager class.
     Set label: Web Approve, Web Reject and Web request to Change
     Set Run On = Called from
g.  Create another two WebActionMenuItems in DAX with your created Submit class.
    Set label: Web Submit and Web Re-submit.
h.  Modify Submit class for Submitting workflow.
    DialogOk, init and reSubmit method
Figure 1: DialogOK() of submit class, write this code after menuIten calls. Here “EP_PolicySubmit” and “EP_PolicyReSubmit” are the WebActionMenuItem of EPWorkflowWorkItemActionManager.

Figure 2: Init() method of submit class: Add the highlighted line with your web policy submit menuItem name


                  
Figure 3: ReSubmit method of submit class: Add the highlighted line with your web policy Re-Submit menuItem name

i.       Now set the webmenuItems in different places….
       a.       Web Submit: Workflow Template (Properties) ->  submitToWorkflowWebMenuItem
         b.      Web Re-Submit: Workflow Approval (Properties) -> ReSubmitWebMenuItem
         c.       Web  Approve: Workflow Approval ->Outcomes->Approve (Propeties) -> ActionWebMenuItem
        d.      Web  Reject: Workflow Approval ->Outcomes->Reject (Propeties) -> ActionWebMenuItem
        e.      Web  Req. to Change: Workflow Approval ->Outcomes-> RequestChange (Propeties) -> ActionWebMenuItem

And now workflow is ready for web. Please reset the IIS and Refresh AOD from EP before the submit of Workflow.  



Monday, June 21, 2010

Microsoft Dynamics AX 6.0 (2011) New X++ Editor

Good news for all DAX developers.... DAX 2011/6.0 has introduced new and interesting features in X++ editors. I have found a very helpful & interesting video regarding X++ editor in YouTube. Features are very nice and also very useful for the developer. I am sharing with you. Please click and see the bellow video....

..... :)