Skip to main content

Notifications

Dynamics AX AIF Remove BOM bits from UTF-8-BOM

Developing SEPA (ISO 20022) modification in AX 2012 for Lithuanian bank requirements I used AIF SEPA Credit Transfer outbound port as described in https://blogs.msdn.microsoft.com/axsupport/2013/11/25/how-to-setup-sepa-credit-in-ax2012-r2/

All modifications were carried out in AX2012R3RTM_STD_VendPayments_SEPACreditTransfer_03_xsl.xsl

But after first tests I got additional requirements. 

1. Use UTF-8 instead of UTF-8-BOM 

Wrong:

utf8bom.png

Desired output:

utf8Nobom.png

2. Removing xsi:schemaLocation from root Document tag:

3441.image001.png

 

 

I was unable to achieve these objectives using XSL transformations. So I implemented .NET assembly transforms for meeting those requirements.

Two methods were created:

RemoveUTF8BOMBytes: If UTF-8-BOM is detected remove first BOM bytes converting it to UTF-8

TruncateXsiSchemaLocationAndOutputAsUTF8NoBom truncates xsi:schema attribute and converts to utf-8 (noBom). If TruncateXsiSchemaLocationAndOutputAsUTF8NoBom is used then RemoveUTF8BOMBytes is not needed. But RemoveUTF8BOMBytes is more efficient

 

AIFTransform.dll can be applied to AIF Outbound port by following this procedure:

Open AIF outbound ports and click outbound transforms:

5516.Outbound-Transforms.png

 Click manage transforms

7673.ManageTransforms.png

Create new transform

1307.newTranform.png

Name it removeBomBytes choose .NET assembly as type and hit load

3463.removeBomBytesLoad.png

Browse and selectAIFTransform

6177.chooseDll.png

Now in the class field you can choose required method RemoveUTF8BOMBytes or TruncateXsiSchemaLocationAndOutputAsUTF8NoBom  

4530.chooseRemoveUtfBytsmethod.png

After choosing RemoveUTF8BOMBytes  close manage transforms form and create new outbound transform line then choose removeBomBytes 

8244.choosetransform.png

Make sure that RemoveUTF8BOMBytes  is last outbound transform otherwise another xsl transformations will outputing file as UTF-8-BOM from AIF.

0310.movedown.png

Final result should look like this:

4540.final.png

AIFTransform.dll can be downloaded from http://1drv.ms/1PzHs35 

AIFOutboundTransform solution:

solution.png

Archived Visual studio 2013 AIFOutboundTransform solution can be downloaded from AIF Remove UTF-8-BOM bom bits

Comments

  • Lauras U Profile Picture Lauras U 955
    Posted at
    Dynamics AX AIF Remove BOM bits from UTF-8-BOM
    Updated  VS solution and DLL link
  • Community Member Profile Picture Community Member Microsoft Employee
    Posted at

    Hi, the link does not work ;/

  • Lauras U Profile Picture Lauras U 955
    Posted at

    Hi. It looks like you have to be logged in one drive. Anyway I uploaded to dropbox as mirror: dl.dropboxusercontent.com/.../AIFOutboundTransform.zip

  • Community Member Profile Picture Community Member Microsoft Employee
    Posted at

    Hi Lauras,

    Thanks for your solution.

    Unfortunately one drive link http://1drv.ms/1PzHGHs seems to be expired.

    Can  you please share  VS solution at another place or email to vikaschanky.pce@gmail.com ?

  • Lauras U Profile Picture Lauras U 955
    Posted at

    Iv'e just checked and it one drive works for me

  • Frank Huster Profile Picture Frank Huster 2
    Posted at

    Hi Lauras,

    thanks for your investigation and the vs solution. Currently, we have the same issue for a sepa xml output. Could you send me your VS Solution to fhuster@hso.com? Your OneDrive folder is empty and the download link does'nt work anymore ;-).

    Thanks a lot, cheers Frank