Tuesday 12 May 2015

Update DefaultDimension through Connector for Microsoft Dynamics

We had interesting problem with updating of some data entities' DefaultDimension. Normally for update Connector asks for original data (performs find operation), uses those data as default data and overwrite only those data where values are provided from 3rd party system. It means that any of data defaulted in AX, when create operation was performed, is not overwritten by empty values.

Wednesday 11 February 2015

Default Dimensions seem to be just single field of type long instead of dictionary entity in Connector and in VS

There is probably incorrect Extended Data Type on DefaultDimension field in table. There should be DimensionDefault. If there is another one (e.g. RefRecId) then correct code is not generated by AIF wizard to Ax<Table> class and to Data object class.

If you can change EDT then do it and regenerate AxBC classes and data objects.

If you can’t change EDT or regeneration did not help then update classes manually:

Ax<Table> class: 
change EDT in parmDefaultDimension method to "DimensionDefault"

<Service>_<Table> class:

add method createDefaultDimension

public AifDimensionAttributeValueSet createDefaultDimension()
{
    return this.get_NewContainer(#DefaultDimension);
}

change method parmDefaultDimension

public AifDimensionAttributeValueSet parmDefaultDimension(AifDimensionAttributeValueSet _value = null)
{
    if (!prmisDefault(_value))
    {
        this.set_Container(#DefaultDimension, _value);
    }
    return this.get_Container(#DefaultDimension);
}

Friday 31 October 2014

AX 2012 Integrations - using Microsoft Connector for Dynamics

Although MS Connector for Dynamics' purpose is to connect and integrate products from MS Dynamics family it is possible to use it to integrate AX and 3rd party's systems.

We are currently using Connector this way. I faced several problems through AIF services development to be able to use them with Connector. Here are some points.

Thursday 22 May 2014

AX 2012 R3 Demo running on Azure

I was thinking how to try new release of AX 2012 when the test environment (virtual machine) provided by Microsoft is quite demanding and I have no server with required configuration.
I found this article about how to set up AX 2012 R3 demo on Azure. Hope it will help.

http://blogs.msdn.com/b/axinthefield/archive/2014/05/01/setting-dynamics-ax-2012-r3-demo-with-lcs-and-azure.aspx

Note: You will need acces to Dynamics Lifecycle Services (https://lcs.dynamics.com/) and some Azure subscription.

Friday 28 March 2014

Microsoft Office for iPad

I've just tested Microsoft Excel and PowerPoint for iPad. Attached documents are created on iPad mini.

For me Microsoft Office for iPad is quite perfect software.

PowerPoint sample

Excel sample

Ax 2012: Pass printer settings from class dialog to SSRS report

For one project I needed to create standard runnable class which calls SSRS report in a while loop. The question was how to work with the printer/destination settings.

Solution: 

1. Create your runnable class "YourController" from which you will control calls of your report "YourReport".

2. Create your printer setup class "YourPrinterSetup".

class YourPrinterSetup extends RunBase
{
    Map                     mapPrinterSettings;
    YourController   baseClass;
    Args                    args;

    #define.CurrentVersion(1)
    #localmacro.CurrentList
        mapPrinterSettings
    #endmacro
}

void new(Args _args)
{
    ;
    mapPrinterSettings = new Map(Types::Enum, Types::Container);
    Args = _args;

}

public container pack()
{
    return [#CurrentVersion, [#CurrentList, mapPrinterSettings.pack()]];

}

public boolean unpack(container _packedClass)
{
    Version     version;
    container   packedPrinterSettings, packedOutPaymRecordList, packedValues;

    version = RunBase::getVersion(_packedClass);

    switch (version)
    {
        case(#CurrentVersion) :
            [version, packedValues] = _packedClass;

            [#currentList, packedPrinterSettings] = packedValues;
            break;
        default :
            return false;
    }

    if (packedPrinterSettings)
    {
        // Recreate the object from the packed values.
        mapPrinterSettings = Map::create(packedPrinterSettings);
    }
    else
    {
        mapPrinterSettings = new Map(Types::Enum, Types::Container);
    }

    return true;

}

static void main(Args _args)
{
    YourPrinterSetup printSetup = new YourPrinterSetup(_args);

    printSetup.run();

}

updatePrinterSettings is used to store chosen settings.

public void updatePrinterSettings(container _printerSettings)
{
    mapPrinterSettings.insert("1", _printerSettings);

    baseClass.setPrinterSettings(_printerSettings);

}

In run method the standard SRSPrintDestinationSettings class is called. 

void run()
{
    SrsPrintDestinationSettings printSettings;
    FormRun                     printSettingForm;
    boolean                     ok = true;
    Object                      caller = args.caller();

    baseClass = caller.runbase();

    printSettings = new SrsPrintDestinationSettings();
    printSettings.unpack(this.getPrinterSettings());

    printSettings.fromPage(1);
    printSettings.toPage(99999999);

    args.caller(printSettings);
    args.name(formstr(SRSPrintDestinationSettingsForm));

    printSettingForm = classfactory.formRunClass(args);
    printSettingForm.init();
    printSettingForm.run();
    printSettingForm.wait(true);

    ok = printSettingForm.closedOk();

    if (ok)
    {
        this.updatePrinterSettings(printSettings.pack());
    }

}

3. Create Menu item "YourPrinterSetupMenuItem" of type Action. Object type Class, Object "YourPrinterSetup" class.

4. Add "YourPrinterSetupMenuItem" to the dialog of your "YourController" class. Something like this:

dialog.addMenuItemButton(MenuItemType::Action, "YourPrinterSetup", DialogMenuItemGroup::CurrentGrp);

5. Don't forget to implement setPrinterSettings method to your "YourController" class. It is used to pass chosen printer settings to "YourController".

public void setPrinterSettings(container _settings)
{
    printerSettings = _settings;

    printDestinationSettings = new SRSPrintDestinationSettings();
    if (conlen(printerSettings) > 0)
    {
        printDestinationSettings.unpack(printerSettings);
        dialogReportDestination.value(strFmt("%1", printDestinationSettings.printMediumType()));
    }
}

6. Pass printer settings to your "YourReport". Use it in that place where you call the report. See example below.

public class YourController extends RunBaseBatch
{
    container       printerSettings;
}

public void run()
{
    SrsReportRunController      srsReportRunCont;
    SRSPrintDestinationSettings printDestinationSettings;

    printDestinationSettings = new SRSPrintDestinationSettings();

    if (conlen(printerSettings) > 0)
    {
        printDestinationSettings.unpack(printerSettings);
    }

    srsReportRunCont = new SrsReportRunController();
    srsReportRunCont.parmReportName('YourReport.Report');
    srsReportRunCont.parmReportContract().parmPrintSettings(printDestinationSettings);
}

Hope it will help someone.
Mind that you can modify SrsPrintDestinationSettingsForm to enable/disable possibilities.

Tuesday 12 November 2013

MS SQL Server 2012: I forgot to add an administrator account

Maybe you had previously the similar problem. You were installing MS SQL Server 2012 and you forgot - missed - or your choice was not correct - to add an administrator account to administer your new SQL Server. I had another problem - I've added Administrators group, not an administrator user. I hoped that it will work for all users in that proper group. Unfortunatelly not.
So I searched google for some solution. Of course, I found a lot of articles about creating new login with sa privileges.
E.g. http://www.practicalsqldba.com/2012/08/sql-server-lost-all-administrator.html

But due to a higher security I've chosen the Windows authentification only. My newly created SQL account didn't work. I had to enable the Mixed authentification on my SQL instance. And I want to share this guide because when I searched it on google I was not successful.

1. Run regedit
2. Locate MSSQL setup

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.'YOUR INSTANCE NAME'\MSSQLServer

3. Modify LoginMode key to value 2.
It means 1 for the Windows authentification, 2 for the Mixed one.

You have to restart your database service.

Then create new login for your windows user, assign him proper role and switch LoginMode back to the Windows authentification.

Saturday 5 October 2013

CRM 2011: "CRM is trying to connect" stuck in Outlook client

WARNING:
Solution of this problem is not included in this article. Unfortunately.

STORY:
Once upon a time I decided that it is the right time to start to play with the MS Dynamics CRM. I've installed new W2003 Server virtual machine, SQL 2005, CRM 4 and MS Office 2003. Everything works nice, web client and outlook CRM client too.

So I tried to create new virtual machine for CRM 2011. I've installed W2008 Server R2, SQL 2008, MS Office 2013 and CRM 2011, applied all SPs. 

The first - clear CRM 2011 (without rollups, I don't know if there is some rollup which supports the Office 2013) doesn't support the Office 2013. So I uninstalled them and installed Office 2003. Everything was fine. 

I started to study some MS course (Introduction to MS Dynamics 2011) and I found out that the Word 2010 should be better for Mail merging. I uninstalled the Office 2003 and installed the Office 2010. Then I uninstalled the CRM client and installed it once more. 

Unfortunately Outlook 2010 crashed with enabled CRM Client add-in. So I uninstalled whole CRM Server and did whole new installation of the CRM Server and the CRM Outlook Client. It didn't help. Outlook was still crashing.

I uninstalled the Office 2010 and installed the Office 2007. Client was reinstalled too. Outlook hadn't crashed anymore but it was unable to connect to the CRM Server. It got stuck on information "CRM is trying to connect". I tried google but there was no useful solution. Nothing worked for me. I thought: Danny, the Office 2003 worked before, try it.

But still it was not possible to connect to the the CRM Server from the Outlook 2003. Still connecting message. Web client worked fine.

Next step was remove that virtual machine. Currently I am installing brand new virtual machine .o)

UPDATE:
I've configured new virtual machine. Order of installation - W2008 Server R2 64bit, Active directory, Office 2010, SQL Server 2008, CRM Server 2011, CRM Client for Outlook. Now it works. It's little freaky.

SUMMARY:
Unfortunately nothing helped me. Only the re-instalation of the whole environment. 

Friday 20 September 2013

Ax 2012: Publikování kódu na server

Pokud upravujete kód, který je prováděn na serveru (batch nebo nějaký jiný server job), pak je vždy po úpravě kódu v Ax potřeba kód publikovat do CIL.
Provede se to použitím tlačítka ve vývojovém prostředí