Dynamics Search Engine

Friday, April 11, 2014

How to fix synchronization error ‘Cannot create a record in Version control changes (SysVersionControlTmpChange)’ with TFS while importing?

How to fix synchronization error ‘Cannot create a record in Version control changes (SysVersionControlTmpChange)’ with TFS while importing?

Applied on: Dynamics AX 2012 R2
Prerequisite: Basic Dynamics AX 2012 programming knowledge & basic knowledge of how to use Team Foundation Server (TFS).
Target audience: AX programmers
Assumption: You are familiar with Dynamics AX 2012, TFS and Visual Studio .Net

 
Symptom:

1)     When you try to synchronize a model with Team Foundation Server (TFS), it throws error like “Cannot create a record in Version control changes (SysVersionControlTmpChange). Change Number: [a numeric number]. The record already exists.”

 
2)     You try to synchronize an object with TFS and system throws errors “Cannot create a record in Version control changes (SysVersionControlTmpChange). Change Number: [a numeric number]. The record already exists.”

 
A sample error.

 
I was facing the above error and came up with a solution as below.

The above screenshot shows a RecID “5637527359”. I searched for this RecID in SysVersionControlSynchronizeLog table record and got the record, noticed that ItemPath field of this searched record shows a value where I can see AOT path for a view called DirPartyPostalAddressView.

Then I searched SysVersionControlSynchronizeLog table for view DirPartyPostalAddressView using ItemPath field as shown below.






It shows two entries (record) for DirPartyPostalAddressView in the searched result. Here system has two entries for DirPartyPostalAddressView so during TFS synchronization it tries to create two entries to table SysVersionControlTmpChange and this table does not allow more than one entry for the same object. During 2nd entry for DirPartyPostalAddressView to SysVersionControlTmpChange, system throws error “The record already exists.”

Now I have the visibility to which object the problem is associated with. So I opened the AOT and went to view DirPartyPostalAddressView, compiled it and synchronized it with TFS. On synchronization it throws same error. Then I started looking to the customization done for this objects and came out with a conclusion that some incorrect customization was there. I fixed it and it was working perfectly.

Hope this piece of information will be useful for you.
You may write your comments below.

Tuesday, February 25, 2014

How to resolve CIL problem when it says Cannot create a record in SysXppAssembly (SysXppAssembly). The record already exists.

How to resolve CIL problem when it says Cannot create a record in SysXppAssembly (SysXppAssembly). The record already exists.

Sometimes you try to general incremental CIL or full CIL and receive error like "Cannot create a record in SysXppAssembly (SysXppAssembly). The record already exists." as shown below.



How to get out of this error?

The solution is simple. You need to restart the AOS.

Applied on: Dynamics AX 2012 R2
Prerequisite: Basic Dynamics AX 2012 knowledge

Target audience: AX programmers
Assumption: You are familiar with Dynamics AX 2012

Hope this was useful. You may leave your comments below.



 

Friday, February 21, 2014

How to resolve error Disconnected from the AOS for Microsoft Dynamics AX 2012 and Visual Studio .Net

Why you get error "Disconnected from the AOS" when you open Visual Studio and try to see Application Explorer tool box to customize something for Microsoft Dynamics AX Enterprise Portal or SSRS Reports?




Reason:

The Visual Studio instance you open does not refer the configuration which is configured. Such error you will encounter when you have different client and AOS system. For example; Server 1 is having Application Object Server (AOS) and System 1 is having AX client so you have AX client and server on different machines. Other way your Visual Studio instance is not connected to target Microsoft Dynamics AX AOS configuration.

Applied on: Dynamics AX 2012 R2

Prerequisite: Basic Dynamics AX 2012 knowledge
Target audience: AX programmers
Assumption: You are familiar with Dynamics AX 2012 and Visual Studio .Net


Solution:
Option 1: You should have AX client and server on the same machine. In general development server with multi users is not configured with single machine based.

Option 2: If your AX client and server are on different machines, you need to launch your Visual Studio instance using a shortcut from AX client machine and that shortcut should have target AOS configuration. E.g. You have an AX configuration file called VAR_DEV.AXC to launch the correct AOS. Get a shortcut of your Visual Studio on AX client machine right click on it. You will see the property dialog as shown below.


 

You will see the Visual Studio instance common IDE path [see above]. This is the default path. The depends based on installation.

The Target field should have path "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe". This is the default path.

The action you need to perform is to add target for AOS configuration file to it. To achieve this replace the path with "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" /AXConfig \\[File location]\DEV04_VAR.AXC


After modifying this value click on Apply button. Now you launch your Visual Studio by double clicking this Visual Studio Icon. It will allow you to see AOT objects as shown below.
 
 


Option 3: On AX client machine configuration utility you can upload configuration file DEV04_VAR.AXC. To do this, open Microsoft Dynamics AX 2012 Configuration Utility from Administrative Tools. Click on Manage button then Set Configuration Stone.



Click on Apply button then OK.

Now you can launch your Visual Studio on AX client machine from Start button > All Programs > Microsoft Visual Studio 2010 folder > Microsoft Visual Studio 2010.



Hope this was useful for you. You may leave your comments below.

 

Wednesday, February 19, 2014

How to call an AIF Service operation and send data outside Microsoft Dynamics AX 2012 using X++ code


Sometimes it happens like you developed an AIF Service in Microsoft Dynamics AX and not able to test. Reason can be anything. Consider a scenario where you need to send AX data outside using standard AIF services but don’t know how to send.
This article explains you how to run a read operation for an AIF Service to send data from Microsoft Dynamics AX to your destination folder using File System Adapter. This article may answer below questions:

Using X++ codes how to call a service operation for Microsoft Dynamics AX 2012 AIF?
How to call or execute read operation in Microsoft Dynamics AX 2012?
How to send data outside Microsoft Dynamics AX 2012 using Outbound?

How to use standard Microsoft Dynamics AX 2012 AIF Services?

Applied on: Dynamics AX 2012 R2
Prerequisite: X++; MorphX; Basic programming knowledge, Basic AIF
Target audience: AX programmers
Assumption: Outbound port is configured properly. The person has the basic idea about AIF.

Here I used a standard service call VendVendTableService and read operation of it to send Vendor data outside.

Below job is to select a vendor record and send to Queue Manager.

 
static void aifOutBoundServiceCall(Args _args)
{
    AxdSendContext      axdSendContext  = AxdSendContext::construct();
    AifEntityKey        aifEntityKey    = AifEntityKey::construct();
    Map                 keyData;
    AifConstraintList   aifConstraintList   = new AifConstraintList();
    AifConstraint       aifConstraint       = new AifConstraint();
    VendTable           vendTable;

    select firstOnly vendTable
        where vendTable.AccountNum == "‪‪V-1001";

    keyData = SysDictTable::getKeyData(vendTable);
    aifEntityKey.parmTableId(vendTable.TableId);
    aifEntityKey.parmRecId(vendTable.RecId);
    aifEntityKey.parmKeyDataMap(keyData);

    axdSendContext.parmXMLDocPurpose(XMLDocPurpose::Original);
    axdSendContext.parmSecurity(false);
    aifConstraint.parmType(AifConstraintType::NoConstraint) ;
    aifConstraintList.addConstraint(aifConstraint) ;


//To handle an error it can be checked if outbound port is configured. This is optional.
    AifSendService::submitDefault(  classnum(VendVendTableService),
                                    aifEntityKey,
                                    aifConstraintList,
                                    AifSendMode::Async,
                                    axdSendContext.pack());

}
 

Below logic can be used to check whether Outbound port is configure or not properly. It’s not mandatory but nice to have.
boolean canSendXML()
{
    boolean             ret;
    AifActionId         actionId;
    AifEndpointList     endpointList;
    AifConstraint       aifConstraint = new AifConstraint();
    AifConstraintList   aifConstraintList = new AifConstraintList();

    actionId = AifSendService::getDefaultSendAction(classnum(VendVendTableService), AifSendActionType::SendByKey);

 

    if (actionId)
    {
        aifConstraint.parmType(AifConstraintType::NoConstraint);
        aifConstraintList.addConstraint(aifConstraint);
 
        endpointList = AifSendService::getEligibleEndpoints(actionId, aifConstraintList);
 
        if (endpointList.getEndpointCount()>0)
        {
            ret = true;
        }
    }

    return ret;
}

 
To release data from Queue Manager below job can be executed.

static void aifOutboundExecutoinJob()
{
    new AifOutboundProcessingService().run();
    new AifGatewaySendService().run();
}

 
 
After execution of above job below is the output.