AX 4.0 Send GUID in AIF document

I’ve noticed a a bug in AX 4.0 (K/A: 4.0.2501.116) AIF implementation when using a table field type GUID. Unfortunately the generated XSD schema referred to the field type as Int64 instead of GUID. The sent XML of course contained an GUID String {00000000-1234-5678-9101-000000000000}. My C# .NET client reported an error because the received value was not a valid Int64.
I solved the problem by editing AxdBaseGenerateXSD.addGuid() method
protected void addGuid(
SysDictType dt,
XmlSchemaSimpleTypeRestriction restriction
/*  restriction.baseTypeName(
targetNameSpace)); */
restriction.baseTypeName (XmlQualifiedName::construct(
As result the generated XSD schema contained the correct GUID definition
<xs:simpleType name=”AxdExtType_MyGUID“>
<xs:documentation xml:lang=”DE-AT“>A Guid field</xs:documentation>
<xs:restriction base=”AxdType_GUID” />

<xs:simpleType name=”AxdType_GUID“>
<xs:restriction base=”xs:string“>
<xs:minLength value=”38” />
<xs:maxLength value=”38” />
value=”({[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}})” />

About erpcoder
Azure Cloud Architect and Dynamics 365 enthusiast working in Research & Development for InsideAx

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: