Wednesday, March 4, 2015

Error "An unexpected error has occurred while opening the workflow. See the event log on the AOS and contact your system administrator to resolve the issue" on creating the workflow.

To resolve mentioned error we have following options.

Solution 1:
Do incremental CIL compile.

Not succeeded?!

Solution 2:
Do full CIL compile.

Still not succeeded?!

Solution 3:

Stop AOS service.

Rename XppIL folder to XppIL_old. form the following location.
<Drive letter>:\Program Files\Microsoft Dynamics AX\60\Server\<Instance Name>\bin

Start AOS service.

Do full CIL compilation.

Now your face should be filled with SMILE :)

Have any question?! Please comment.

Tuesday, January 20, 2015

Caching Display Methods in Microsoft Dynamics AX

The performance of display methods can be improved by caching mechanism.

This must be used while methods are of following nature.
1) Used for complex calculations.
2) Returning large string data.
3) Display image data.

How To:

Option 1:
  • On the form expand the Data Sources node.
  • Override init method.
  • Call formDataSource.cacheAddMethod() after super() in the init method.
  • First parameter determines name of method 
  • Second parameter is boolean, which indicates that whether the value of display method is updated when record is written to the database.
Public void init()
{
super();
this.cacheAddMethod(
tablemethodstr(<table>,<display method>),                                       [_updateOnWrite]
); 

}

Option 2:
  • Use "SysClientCacheDataMethodAttribute" attribute in display method declaration.
[SysClientCacheDataMethodAttribute ([_updateOnWrite])]
display <ReturnType> methodName(){....}




Option 3:
  • Set form control property CacheDataMethod to “Yes” on the form. This option is available for methods which are created at table level.

Note:
The value of all cached methods is set when data is fetched from the back-end database. In addition, the value is refreshed when the reread method is called on the form data source.

All the above options are supported with AX 2012 R2 & R3, for AX 2009 only first option is available.


Saturday, September 6, 2014

Ammy Admin Error 12007 with Windows 8

I’ve been using Ammyy Admin for a while now, but since I’ve upgraded to Windows 8.1, the program seems to fail it’s initial connection. same is for Windows 8.
It keeps popping out an error:
Error {12007} occured while connecting to server “http://rl.ammyy.com”
Would you like to change proxy settings? 
Ammy Admin Error 12007 Windows 8

To solve this, open the Ammyy Admin setting menu and un-check “Run under SYSTEM account on Windows Vista/7/2003/2008″ check-box.























After Applying this settings Restart Amnyy. This time your face should be filled up with smile. :)

Wednesday, March 21, 2012

Add new number sequence to existing AX module


To demonstrate this I have creted new form “Method table” which stores some of the characteristics of the items so I have added this Method table to Invent module.
Key for this table is “MethodId” & we are going to create number sequence for this table.

Look out the following steps to add number sequence for newly created form/table in existing module of AX 2009
1.   Create New EDT (Extened data type), i.e “MethodId” of type “str” size “20”.
2.   Find Number sequence class, in this case it is “NumberSeqReference_Inventory”.
3.   Find “LoadModule” method, add following code at the end of the method.






















4.  Create Following method to Form’s (The Form on which you have added data source) method.
NumberSeqFormHandler numberSeqFormHandler()
{
    if(!numberSeqFormHandler)
    {
        numberSeqFormHandler = NumberSeqFormHandler::newForm(ItemMethodTable::numRefMethodId().NumberSequence,
        element,ItemMethodTable.dataSource(),fieldnum(ItemMethodTable,MethodId));
    }
    return numberSeqFormHandler;
}


5.  Add folloing code to specified methods on the Form where you have added created table.
-          In Write Method
After super() write, element.numberSeqFormHandler().formMethodDataSourceWrite();
-          In Create Method
Before super() write,
       element.numberSeqFormHandler().formMethodDataSourceCreatePre();
After Super write,
element.numberSeqFormHandler().formMethodDataSourceCreate();
-           In delete Method
Before super() write,
      element.numberSeqFormHandler().formMethodDataSourceDelete();
           6. Now, you are done with code part, to give final touch go to, basic> Setup> Number Sequence and run       Wizard. To show up your created Number sequece in List.

That’s it. Enjoy DAXing J


Multiple (Auto + Manual) Number Sequences in AX 2009 & AX 2012


Usecase
Some of the customers want to use multiple number sequence for single table that is not currently available in AX 2009.
i.e. In invent module to create different types of items one required to use different sequence, here  addon comes into picture.

Technical Section
Create new class “NumberSeqDialog” and add methods as listed below.
class NumberSeqDialog extends RunBase
{
    NumberSequenceCode      parentCode;
    NumberSequenceCode      selectedCode;
    DialogField             dialogFieldNumberSeq;
    Dialog                  dialog;
}
public Object dialog()
{
    ;
    dialog = super();
    dialog.caption("Select number sequance");
    dialog.allowUpdateOnSelectCtrl(true);

    dialogFieldNumberSeq = dialog.addField(TypeID(NumberSequenceCode),"Select Number Sequence: ");

    return dialog;
}

public void dialogPostRun(DialogRunbase _dialog)
{
    ;
    _dialog.formRun().controlMethodOverload(true);
    _dialog.formRun().controlMethodOverloadObject(this);
    super(_dialog);
}

Below method will give you answer  of populer question
“How to override Control’s event method?”
Also gives you an idea of
“How to create lookup field on Dialog?”
public void Fld1_1_lookup()
{
    Object control = dialog.formRun().controlCallingMethod();
    ;
    NumberSequenceTable::lookupNumberSequenceCode(control, this.parmParentCode());
}

public boolean getFromDialog()
{
    ;
    this.selectedNumberSeqCode(dialogFieldNumberSeq.value());
    return true;
}

Below to method say, if you don’t want to use “pack unpack” create me like this!!!
container pack()
{
    return connull();
}
boolean unpack(container _packedValues)
{
    return true;
}

NumberSequenceCode parmParentCode(NumberSequenceCode _parentCode = parentCode)
{
    parentCode = _parentCode;
    return parentCode;
}

NumberSequenceCode selectedNumberSeqCode(NumberSequenceCode _selectedCode = selectedCode)
{
    selectedCode = _selectedCode;
    return selectedCode;
}

Modify NumberSequenceTable table

Add below fields to NumberSequenceTable
 “NumberSequenceParent” to set parent Number sequence. EDT, which will refer to NumberSequenceCode.
“Search for parent” to NoYes type enum field.
So finally it will look like,



 Modify “NumberSeqFormHandler” class
Create instance of above class in “NumberSeqFormHandler” class.
Put below code in to newForm method

   if(NumberSequenceTable::find(_numberSequenceCode).SearchForParent)
    {
        numberSeqDialog = new NumberSeqDialog();
        numberSeqDialog.parmParentCode(_numberSequenceCode);
        if(numberSeqDialog.prompt())
        {
            _numberSequenceCode = numberSeqDialog.selectedNumberSeqCode();
        }
    }

So after adding above code your newForm method will look like,

static NumberSeqFormHandler newForm(NumberSequenceCode      _numberSequenceCode,
                                    ObjectRun                 _callerForm,
                                    FormDataSource          _formDataSource,
                                    fieldId                 _fieldIdNum,
                                    boolean                 _dontThrowOnMissingRefSetUp = false
                                   )
{
    NumberSeqFormHandler numberSeqFormHandler;
    NumberSeqDialog      numberSeqDialog;
    ;
    if (!_formDataSource || !_fieldIdNum)
        throw error(strfmt("@SYS70841",funcname()));

    //<Intech>
    if(NumberSequenceTable::find(_numberSequenceCode).SearchForParent)
    {
        numberSeqDialog = new NumberSeqDialog();
        numberSeqDialog.parmParentCode(_numberSequenceCode);
        if(numberSeqDialog.prompt())
        {
            _numberSequenceCode = numberSeqDialog.selectedNumberSeqCode();
        }
    }
    //</Intech>
    numberSeqFormHandler = NumberSeqFormHandler::construct(_formDataSource);

    numberSeqFormHandler.parmNumberSequenceCode(_numberSequenceCode);
    numberSeqFormHandler.parmFormDataSource(_formDataSource);
    numberSeqFormHandler.parmFieldIdNum(_fieldIdNum);
    numberSeqFormHandler.parmDontThrowOnMissingRefSetUp(_dontThrowOnMissingRefSetUp);
    return numberSeqFormHandler;
}
Direction of use

First of all you have to decide on which form you want to use multiple number sequence. Let’s say you have chosen InventTable and want to create items on item details page with different number sequence.
Next step is, go to Basic Setup> Number Sequences.  Find which number sequence is currently y in use to create new item. Let’s say its “Inv_60”, Remember this Number Sequence will be treat as BASE or say PARENT  number sequence.

Now, create different number sequences, as I have created “RM_61”, “FG_62” and “SFG_63” . Select  “Inv_60” against these create number sequences.
One more thing required to active this functionality, that is “Search for parent” option must be ticked on setup tab for “Inv_60” number sequence.

Have you done with all above steps?? If yes, you are ready to use this addon, Just go to Item details page. While creating new item it will search Three number sequences 61 to 63 created above.
and pop up with box shown below.



Select number sequence which you want to use for current item.

Furthermore, you want to give Number manually along with auto number sequence. Just select any of the above (61 to 63) as manually. You will  be having auto + manually number sequences!!!

Any suggestions and questions are Welcomed.

Happy DAXing J

Wednesday, November 16, 2011

How to decide the RunOn property value in Dynamics AX?

While working with Client-Server programming, code placement is crucial to decide otherwise it will results in performance hit. Let's have a look at RunOn property of different AOT objects.

Classes
-     The value of RunOn property for a class will be same as the parent class if the parent class has a RunOn property other than Called from i.e. the RunOn property cannot be changed for a class if the parent class has as its value either Client or Server. 
-     If the parent class has Called from as its RunOn property value, it can be changed to Client or Server and if it is not changed it will retain the inherited value i.e. Called from.
-     The Called from value of the RunOn property means the object will live at the tier where the code creating it (by calling the new constructor) is running.

Methods
-     Class static methods and table methods (except for the database methods) can have their default behavior.
-     The execution place for a method can be changed to Server or Client by adding the Client or Server modifier keywords in the method declaration as shown below:
o    server static boolean mymethod(): to make server the execution place.
o    client static boolean mymethod(): to make client the execution place.
o    client server static boolean mymethod(): to make called from the execution place.

GUI Objects and Reports
-     GUI objects always live on Client. GUI objects include the FormRun, FormDataSource, all FormControls, DialogBox, and OperationProgress objects.
-     Reports always live on Called from, which means the object will live at the tier where the code creating it (by calling the new constructor) is running.

Temporary Tables
-     Temporary tables instantiate and live at the tier where data is first inserted and it does not matter where they are declared. Since the placement of temporary tables is very critical for performance, temporary tables should live at the tier where they are used. If a table is utilized in more than one tier then it should live on the tier where the greatest number of inserts and updates are performed.

Queries
-     QueryRun has called from as the default value of the RunOn property. The QueryRun should always be supplied from the same tier from where it was originally run.
-     If you want to create a new QueryRun in place of an old one, it should be created on the same tier where the old QueryRun was executed.

Tuesday, April 5, 2011

Calculate Cost Price & Sales Price of BOM item.


To calculate Cost and Sales Price of BOM item we have two options as explain below.
      1) Use Cost specified in cost field on Item Details card. 
         2)     Use “Active cost” specified using costing version.

Let’s go with 1st approach first.
  • To use Cost price specified on Item Details Card use Costing Version of type “Planned Cost” also specify fallback = Active or particular version.
Let’s have one example.
> Create one item 005, type = BOM, Costing Version = TestCost(Planned Cost Type)
> Create two item to use as bom line for 005,
> Which are 005Line1 & 005Line2, type = item, Costing Version = TestCost(Planned Cost Type).
> Attach this two item to 005 as bom lines, Activate & Approve BOM.
> Now, for item 005 press “Price” button it pops up window, then press “Calculate” button it again pops up another window select Costing Version TestCost, Site, BOM Version. Also select Fallback version = Active.
Press ok button, this calculates Cost Price & Sales Price as you wanted.

Now here is the way to calculate price with 2nd approach.
  • To use Costing Version of type “Standard Cost” first Active price of (components) which are used to make BOM item. Then select the cost version in which you have activated price while calculating price. In this case fallback is not necessary.
Let’s have one example.
> Create one item 006, type = BOM, Costing Version = StdCost(Standard Cost Type)
> Create two item to use as bom line for 006,
   Which are 006Line1 & 006Line2, type = item, Costing Version = StdCost(Standard Cost Type).
> Attach this two item to 006 as bom lines, Activate & Approve BOM.
> Now press “Price” button for 006Line1 & Active cost value for StdCost Version.
> Again press “Price” button for 006Line2 & Active cost value for StdCost Version.

> Finally press “Price” button for 006 it pops up window, on that window press “Calculate” button. It pops up another window select Costing Version StdCost, Site, BOM Version. Also select Fallback version = None.
> Press ok button, this calculates Cost Price & Sales Price as you wanted.

Happening

Upgrade from AX 2012 to Latest Dynamics 365 Finance and Operation

Below are the steps defined by sequence. 1. Create new Upgrade project in Dynamics LCS. 2. Create VSTS Project and connect it with L...

Trending now