Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Wednesday, February 26, 2014

Animation in AX 2012 with showing page is printing...

Hi,
 While processing some long operation we want to user to notify that its progressing by using below style.
you can call in different method when you require.
1. Create a new form
2. Add a animate control as shown below
3. Change the autoDeclaration property of the animate control to Yes.
4.Override the run method of the form with below code
public void run()
{
            int cnt;
            #AviFiles
            ;
            super();
            for(cnt=1;cnt<=600;cnt++)
        {
            Animate.animateFile(#AviPrint);
            Animate.play();
        }
        Animate.visible(true);
}
enjoy

Progress (Loading) bar animation in Dynamic AX 2012

Hi,
static void progressBars(Args _args)
{
    #AviFiles
    SysOperationProgress progress = new SysOperationProgress();
    int i;

    ;

    progress.setCaption("Loading…");
    progress.setAnimation(#AviUpdate);
    progress.setTotal(50000);
    for (i = 1; i <= 50000; i++)
    {
        progress.setText(strfmt("The value of i is %1", i));
        progress.setCount(i, 1);
    }
}


Tuesday, February 25, 2014

Round off the decimal in Dynamic AX 2012

Hi,
//To round off all digit after decimal.
static void roundOff(Args _args)
{
real numb;
;
    numb = trunc(4.68989);
    print strfmt("Round off number= %1",  numb);
    pause;
}

Out put

Round off number= 4.00

Regards,

The site http://servername:xxxxx/sites/DynamicsAX/ is not registered with Microsoft Dynamics AX

Hi,

This error arises often either in home page tab in Dynamic AX or EP page in web.

Solution.
1. Check the business connector
2. Restart the IIS
3. At last even though it is not reflecting create and register new page
 in order to register it,Go to in AX: System Administration > Setup > Enterprise Portal > Web Sites

Container handling in Dynamic AX 2012

Hi,
static void HandlingContainerJob(Args _args)
{
    container contain;
    int i;
    str containstr;
    ;
    contain = ["DataAt1stPosition","DataAt2ndPosition"]; //Data will be inserted at position 1 and 2
    contain = Conins(contain,3,"DataAt3rdtPosition","DataAt4thPosition"); // from 3rd position onward
    contain = conins(contain,5,"DataAt5thPosition"); // now the data inserted in 5th position
    //or use this technique
 
    info (strFmt("Length of the container: %1", conLen(contain)));
    for (i=1; i <= conLen(contain); i++)
    {
        info (strFmt("container value %1 is %2", i, conPeek(contain, i)));
    }
    //containstr =  con2Str(contain);
    // use to pass from one form to another then again str2con() retrive in container format
    /*
        Condel - Use condel to delete one or more items from a container.
        Confind - Use confind to locate a sequence of items in a container.
        Conins - Use conins to insert some items into a container.
        Conlen - Use conlen to find out how many items there are in a container.
        Connull - Use connull to explicitly dispose of the contents of a container.
        Conpeek - Use conpeek to extract an item from a container, and to convert it into another data type, if necessary.
        Conpoke - Use conpoke to replace (poke) an item in a container.
    */
}

Regards

Monday, February 24, 2014

Often using CMD(Command prompt) code

Hi,

dir /s /b /o:gn

dir

XCOPY  C:\*.*  D:\NewFolder\   /S
//XCOPY makes the file copy from C: drive to D:\newFolder


192.168.0.162


dir  - list out directory list

dir *.exe
dir *.txt *.doc
dir /ad - List only the directories in the current directory.
dir /s - Lists the files in the directory that you are in and all sub directories after that directory,
dir /p - If the directory has a lot of files and you cannot read all the files as they scroll by - veritical
dir /w -  Horizontal view of dir
dir /s /w /p
dir /on - dir in sort by alphabet
dir /o-n - dir in reverece order
dir \ /s |find "i" |more - list all directories on the hard drive, one screen page at a time, and see the number of files in each directory and the amount of space each occupies.
dir > myfile.txt - Takes the output of dir and re-routes it to the file myfile.txt instead of outputting it to the screen.

Regards,

How to get calenderID in Dynamic AX 2012

Hi,

Pass the worker table recID to hcmEmployment and get hcmEmployment  recID to WorkCalenderEmployement recID
In that WorkCalenderEmployement table you can find the CalenderId
hcmEmployment           = HcmEmployment::getActiveEmploymentsByWorker(HcmWorker.RecId);
workCalendarEmployment  = workCalendarEmployment::findByEmploymentRecId(hcmEmployment.RecId);
return  workCalendarEmployment.CalendarId;

regards,

Sunday, February 23, 2014

How to give 3 fields in look up with filtering one with previous field in Dynamic AX 2012


1.      Create 3 fields for the table “FormTable” and add to form datasource.
2.      First field with relation in table level so automatically you will get the look up.
·         As FormTable.Fild1
3.      Second field with following lookup code, this look up filter with previous field.
·         As FormTable.Fild2
Public void lookup ()
{
    Query                   query = new Query();
    QueryBuildDataSource    queryBuildDataSource;
    QueryBuildRange         queryBuildRange;
     QueryBuildRange         queryBuildRange1;
    SysTableLookup          sysTableLookup;
     HRCCompGrid                  HRCCompGrid;
    ;
    //Create an instance of SysTableLookup with the form control passed in
    sysTableLookup = SysTableLookup::newParameters(tablenum(HRCCompRefPointSetupLine), this);
    //Add the fields to be shown in the lookup form
    sysTableLookup.addLookupfield(fieldnum(HRCCompRefPointSetupLine, RefPointId));
    sysTableLookup.addLookupfield(fieldnum(HRCCompRefPointSetupLine, RefPointSetupId));
    //create the query datasource
    queryBuildDataSource = query.addDataSource(tablenum(HRCCompRefPointSetupLine));
    //Only show LocalEndpoints for the current company
    queryBuildRange = queryBuildDataSource.addRange(fieldnum(HRCCompRefPointSetupLine, RefPointSetupId));
    select HRCCompGrid where HRCCompGrid.GridId ==SalaryAmend.GridId ;
//SalaryAmend.GridId is the FormTable.Fild1
    queryBuildRange.value(HRCCompGrid.RefPointSetupId);
//this select query makes the queryBuildRange values from another table for the datasource of another table
    //Assign the query to the lookup form
    sysTableLookup.parmQuery(query);
    // Perform lookup
    sysTableLookup.performFormLookup();
    // Don't call super()
    //super()
}
4.       Third field given a lookup with filtering on based of above 2 fields.
·         As FormTable.Fild3
public void lookup()
{
    Query query = new Query();
    QueryBuildDataSource queryBuildDataSource,qbds;
    QueryBuildRange qbr1,qbr2;
    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(HcmCompensationLevel), this);
    sysTableLookup.addLookupfield(fieldnum(HcmCompensationLevel, CompensationLevelId));
    sysTableLookup.addLookupfield(fieldnum(HRCComp, RefPointId));
    sysTableLookup.addLookupfield(fieldnum(HRCComp, GridId));
    queryBuildDataSource = query.addDataSource(tableNum(HcmCompensationLevel));
    qbds = queryBuildDataSource.addDataSource(tableNum(HRCComp));
    qbds.joinMode(JoinMode::ExistsJoin);
    qbds.relations(true);
    qbr1 = qbds.addRange(fieldNum(HRCComp,GridId));
    qbr2 = qbds.addRange(fieldNum(HRCComp,RefPointId));
    qbr1.value(SalaryAmend.GridId);
    qbr2.value(SalaryAmend.RefPointId);
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
    //super();HcmCompensationLevel

}

Tuesday, February 18, 2014

Error: No connection could be made because the target machine actively refused it 127.0.0.1:2383 for Dynamic AX 2012

Hi,

This error will arise in many different cases.
1. Some time it thrown when you open any reports in Dynamic AX 2012
2. Some time it thrown when opening only retail reports in Dynamic AX 2012
3. While connecting to the SSAS from SSMS
Solution:
Start the following services
·         Sql Server Analysis Services
·         Sql Server Agent
·         Sql Server
·         Sql Server Browser
·         Note: Please check “ Sql Server Analysis Services “  Status once you start remaining service may impact on stopping this service.

Regards,




Monday, February 17, 2014

Request for the permission of type 'SqlStatementExecutePermission' failed in Dynamic AX 2012

Hi,

sometimes running a Job in AX will cause above error.

Request for the permission of type 'SqlStatementExecutePermission' failed.
(S)\Classes\SqlStatementExecutePermission\demand
(S)\Classes\Statement\executeQuery
(C)\Jobs\test - line 21


Solution:
                     Run this job on Server.
How to run in server:
                     Create a menu item of type action, give the object type as Job ,and object name , and set the property Run on as" Server ".

Enjoy,

Sunday, February 16, 2014

Error :An X++ exception has occurred - when running the EP website

Hi,

Microsoft Dynamics AX allows only one Enterprise Portal site per legal entity / company. Check the company you are logged on to does not already have a registered EP site (Administration > Setup > Internet > Enterprise Portal > Web sites).

Regards

Error message: "No .NET Business Connector session found"

Hi,

This error is not meant that to increase the session time out span its because of the user list not having previlage to access.
The .NET Business Connector is not configured correctly for the IIS and SharePoint Windows groups.
For the procedure to add the Business Connector to the appropriate group

Regards,

"The Application Integration Framework doesn't work" in Dynamic AX 2012 for EP

Hi,
 EP will be sucessfully installed but it throw the error.
 "the Application Integration Framework doesn't work"
 Application Integration Framework (AIF) to run on the same computer as Windows SharePoint Services (WSS) and Enterprise Portal, the virtual directory that AIF is using must be excluded from the SharePoint managed path.
  1. Open the SharePoint Central Administration page or, from the browser on a remote computer, type the URL (for example, http://servername:port) for the pages on the administration port.
To open the SharePoint Central Administration page, click Start, point to All Programs, point to Administrative Tools, and then click SharePoint Central Administration.

  1. Click Configure virtual server settings, and then click the name of the site that you are managing.
  2. Under Virtual Server Management, click Define managed paths.
  3. Under Add a New Path, enter the AIF virtual directory path, select Excluded path, and then click OK.
Regards

Error message: "http://server/sites/site_name was not created correctly. Exception: Thread was being aborted."


Hi,
This error occurs because of a connection time-out after you select the Microsoft Dynamics AX template while creating a new top-level Web site in Windows SharePoint Administration. To resolve this problem, follow these procedures:
  • Change the Connection timeout and Http Keep-Alive properties on the server that runs IIS.
  • Change connection time-out properties in the web.config file.
Change the Connection timeout and HTTP Keep-Alive properties on the server that runs IIS
  1. Open the Internet Information Services Manager (Start > Run, type inetmgr, and then press ENTER).
  2. Expand the local computer, expand the Web sites directory, right-click the Web site that hosts your Enterprise Portal site (typically the Default Web site), and then clickProperties.
  3. On the Web Site tab, specify a new value in the Connection timeout field. The default value is 120 seconds.
If for example, the server requires up to 4 minutes to create a new site using EP templates, specify a value of 240 seconds.
  1. Select Enable HTTP Keep-Alives (if it is not selected), and then click OK.
  2. Restart IIS (at a command prompt, enter iisreset, and then press ENTER).
Change connection time-out properties in the web.config file
  1. In a basic text editor such as Notepad, open the web.config file (%SYSTEMDRIVE%\Inetpub\wwwroot by default).
  2. Press CTRL + F to open the Find dialog box.
  3. Find the following tag:
<httpRuntime maxRequestLength="51200" />
  1. Replace it with this tag:
<httpRuntime executionTimeout="6000" maxRequestLength="51200" />
  1. Find the following tag (you might need to search from the beginning of the file):
</sectionGroup>
  1. Add the following tags on new lines after the </sectionGroup> tag:
<sectionGroup name="DynamicsAX">
<section name="Deployment" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
  1. Find the following tag:
</SharePoint>
  1. Add the following tags on new lines after the </SharePoint> tag:
<DynamicsAX>
<Deployment SiteCreationTimeOut="1200" />
</DynamicsAX>

  1. Save your changes and close the web.config file.
  2. At the command prompt, type IISReset, and then press ENTER.
  3. Try to create the top-level Web site in SharePoint Portal Administration.

Error message: "The Web site http://server/sites/site_name was not created correctly. Exception: No .NET Business Connector session could be found."

Hi,

This is because of  Business Connector configuration.
So it might not be configured correctly. To verify the configuration, follow this procedure:
  1. On the server that runs IIS and hosts your Enterprise Portal site, click Start > Administrative Tools > Microsoft Dynamics AX Configuration Utility.
  2. In the Configuration target list, click Business Connector (non-interactive use only).
  3. On the Connection tab, verify the server name and the TCP/IP port. If the port is blank, it is assumed to be running on port 2712. To verify the actual port on the AOS server, view Dynamics Information events in the Application Event log after the AOS has started.
  4. If necessary, update the configuration or create a new configuration (click Manage > Create configuration).
regards,

Error message: "Cannot add the specified assembly to the global assembly cache" or "w3wp.exe unhandled exception (System.UnauthorizedAccessException)"

Hi,

The Business Connector proxy account might not have the appropriate permissions on the server to allow access. The Business Connector proxy must:
  • Be a user in Active Directory.
  • Be a member of the Power UsersIIS_WPGSTS_WPG, and the Performance Monitor Windows groups on the server that runs IIS and hosts Enterprise Portal
Create a user with domain in active directory
Also in administrative too you can find above list of members in user in that properties add the member tab Domain / user that you created as business connector proxy

regards

Set the SharePoint authentication provider for EP

Hi,

This is applicable to change for the version of sharepoints used,
'
1.     Ensure that the web.config contains the appropriate configuration information when compared to the web applications settings.
2.     Check the web application settings:
o    Navigate to Central Administration - Application Management - Manage web applications.
o    Select the web application in question
o    Click on the 'Authentication Providers' link from the ribbon
o    Choose the appropriate zone for the web application
o    The dialog box will display the type of membership provider (Windows or Claims-Based Authentication).
o    Record the name of membership provider for the specific zone in the 'Authentication Provider' dialog box.
3.     Locate the web.config file for the web application:
4.     Typically the web.config file is stored at C:\inetpub\wwwroot\wss\VirtualDirectories\Port_Number
5.     Verify the following section in the web.config file
6.  <configuration>
7.      <system.web>
8.        <authentication mode="" />
9.     </system.web>
</configuration>
10.   If the membership provider name is Windows, then authentication mode should be set to "Windows".
11.   If the membership provider is Claims-based authentication, then the authentication mode should be set to "Forms".


Regards,

Sunday, February 9, 2014

Database does not have a valid owner - SQL restore error

Hi,

"Database diagram support object cannot be installed because this database does not have a valid owner".

You may get this error while restoring the database from external source (in *.bak format).

Solution:

Right click on the database properties in the permission tab select grand privilege to all( tick the check box).

now error free for restore.

Regards,

Unable to construct an object from the class in the batch framework

Hi,

when we want to run a custom class in the server as a batch job we need to extend the RunBaseBatch class and schedule a job for it.

When the test was successful, We scheduled the job and waited for the batch job status to go from Waiting to Ended, and to surprise to get an error.

"Unable to construct an object from the class Sample Class in the batch framework. Make sure that the X++ code has been compiled to Microsoft .NET Framework CIL, and that the constructor does not require any parameters"

Steps on how to do this:

1.Open a new development environment and click Build and then choose Generate Incremental CIL.




Then, to double check if the job run well, go to System Administration > Inquiries > Batch Jobs and look for your job. It status should now be Ended.

Regards

The CIL generator found errors and could not save the new assembly

Hi,

Solution to solve this error,

So, how do we fix this problem?

Step 1: Stop the AOS

Atep 2: Delete all of the source in the C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL directory

When you do this, just delete all the files within the XppIL folder that are outside of other folders. Make a backup just in case, and the files would be generated while the full compilation is taking place



Step 3: Start the AOS




Step 3: Perform a full compile (it will not work without doing this)



Step 4: Perform a full CIL generation



 The drawback of this fix is that it takes a long time to complete. However, this fixes the issue, which is the desired outcome, and the services deployment and incremental CIL compilations moving forward would be error free.

As you can see, the service was deployed correctly and if I opened my inbound port I'll see it there.
  


UPDATE:

After a FULL CIL compilation some time you will get the following errors:



AOT > Class> ReleaseUpdateDB41_Basic




I just went to the object in question and compiled them separately.





The outcome would correctly compiled all the artifacts, including my new service gorup. 




Regards,



How find size of recordsortedlist in D365/AX 2012

Hi, This is the continuity of the previous article where we are now getting the size of recordsortedlist . if(recordsortedlist.len() >1) ...