Friday, October 11, 2013

Get FormRun object and FormDataSource from ListPageInteraction class

When we are working on List Page objects in Dynamics AX 2012, we found that methods cannot be added/modified in list page form. We have to work on the corresponding ListPageInteraction class.

Most of the time, we have to get the FormRun object and FormDataSource for different event inside the list page, the following coding can help to get these object form ListPageInteraction class.
  
    ListPage listPage = this.ListPage();
    Common common = listPage.activeRecord([DataSourceName]);
    FormDataSource fds;

    if (common.isFromDataSource())
    {
        fds = common.dataSource();
        fds.formRun().control(fds.formRun().controlId([FormControlName])).userPromptText('New Description');
    }

Multi-selection on form grid handling: MultiSelectionHelper

In Dynamics AX 2012, a new class "MultiSelectionHelper" will handle those heavy lifting task for you as the following.

    Common common;
    MultiSelectionHelper helper = MultiSelectionHelper::construct();
    
    helper.parmDatasource(formDataSource);

    common = helper.getFirst();
    while (common.RecId != 0)
    {
        ...

        common = helper.getNext();
    }

Friday, October 4, 2013

Installing App Fabric on Windows Server 2012 for SharePoint 2013 giving error

While installing Windows Server App Fabric of pre-requisites software for SharePoint 2013, the following error generated in log file and error code 1603 is returned.
 
10-04 11:45:15, Information           Setup  Process.Start: C:\Windows\system32\msiexec.exe /quiet /norestart /i "c:\e435f7e3b63e889120d837c913\Packages\AppFabric-1.1-for-Windows-Server-64.msi" ADDDEFAULT=Worker,WorkerAdmin,CacheService,CacheClient,CacheAdmin,Setup /l*vx "C:\Users\Administrator\AppData\Local\Temp\AppServerSetup1_1(2013-10-04 11-45-15).log" LOGFILE="C:\Users\Administrator\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-04 11-45-15).log" INSTALLDIR="C:\Program Files\AppFabric 1.1 for Windows Server" LANGID=en-US
2013-10-04 11:45:53, Information           Setup  Process.ExitCode: 0x00000643
2013-10-04 11:45:53, Error                 Setup  AppFabric installation failed because installer MSI returned with error code : 1603
2013-10-04 11:45:53, Error                 Setup  
2013-10-04 11:45:53, Error                 Setup  AppFabric installation failed because installer MSI returned with error code : 1603
2013-10-04 11:45:53, Error                 Setup  
2013-10-04 11:45:53, Information           Setup  Microsoft.ApplicationServer.Setup.Core.SetupException: AppFabric installation failed because installer MSI returned with error code : 1603
2013-10-04 11:45:53, Information           Setup     at Microsoft.ApplicationServer.Setup.Installer.WindowsInstallerProxy.GenerateAndThrowSetupException(Int32 exitCode, LogEventSource logEventSource)
2013-10-04 11:45:53, Information           Setup     at Microsoft.ApplicationServer.Setup.Installer.WindowsInstallerProxy.Invoke(LogEventSource logEventSource, InstallMode installMode, String packageIdentity, List`1 updateList, List`1 customArguments)
2013-10-04 11:45:53, Information           Setup     at Microsoft.ApplicationServer.Setup.Installer.MsiInstaller.InstallSelectedFeatures()
2013-10-04 11:45:53, Information           Setup     at Microsoft.ApplicationServer.Setup.Installer.MsiInstaller.Install()
2013-10-04 11:45:53, Information           Setup     at Microsoft.ApplicationServer.Setup.Client.ProgressPage.StartAction()

It would be caused by incorrect PSModulePath in Environment Variable which having a trailing double quote ("), which broke any scripts that used the PSModulePath variable.