web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

XML message for Composite entity

(0) ShareShare
ReportReport
Posted on by 11,633

Hi All,

I have a composite data entity that has been exposed on Odata Endpoint. External application passes an XML message to the Odata Endpoint and records get created accordingly. I have one field which is optional in the data source of an entity, so the external application is not including that field tag in the xml message. But on D365 side, we are getting an error about incorrect XML format. So, basically D365 is expecting the empty XML tag to be there even when no value is there for the field. Is there any option in D365 to avoid this error, if the optional field tag is not passed in the XML message?

Thanks,

Baber.

I have the same question (0)
  • Martin Dráb Profile Picture
    237,926 Most Valuable Professional on at

    Can you elaborate what you did, please? Because composite entities aren't available in OData services (source). Maybe you mean data management package API, or maybe you have a data entity with a string field where you're passing XML containing data for a composite entity, or something.

    Regarding the optional element, it sounds like you have it in source mapping.

  • syed baber Profile Picture
    11,633 on at

    Hi Martin,

    I have setup a Import Data project under Data management framework and added Composite Data Entity with Source data format XML-Element. The recurring data job is setup which runs after every 10 minutes and processes the incoming XML messages. The external application uses the enqueue operation to pass the XML message to the entity. Hope this answers your question. Sorry for mentioning Odata in my first post.

    Thanks,

    Baber.

  • Suggested answer
    Martin Dráb Profile Picture
    237,926 Most Valuable Professional on at

    All right, so you're using the recurring integrations API.

    As I mentioned, it seems to me that you have the field included in source mapping. You should remove it from there if it doesn't exist in the input file.

  • syed baber Profile Picture
    11,633 on at

    Hi Martin,

    It is not always the case that the input file doesn't have the value for that specific field. Just for ease of understanding, consider the field name as "Field1". It is there in the mapping, because it will not always be empty, but when it is empty, the external application is not including the XML tag <Field1></Field1> in the XML message. Hence D365 is giving error that the XML is in incorrect format. Is there any way to make the whole field tag optional ? Please note that the field is already optional in the Data entity.

    Thanks,

  • Martin Dráb Profile Picture
    237,926 Most Valuable Professional on at

    I don't think you can use files with two different structures against a single mapping. If you map a field from source and it's not there, mapping will fail.

    If the external application isn't able to provide a file matching the expected schema, you'll have to transform the file before import.

    By the way, notice that this isn't anything specific to composite entities.

  • syed baber Profile Picture
    11,633 on at

    Thanks Martin for your response. Can you please provide any guidance on how can I do the transformation if an XML tag is absent in the message. Can I add that through transofrmation if it is not there to avoid the error message?

  • Martin Dráb Profile Picture
    237,926 Most Valuable Professional on at

    Yes, using Transformations in source to staging mapping should be possible. These transformations applies before import, which allows you to change the schema to what's expected by data management. Which is your case too.

  • syed baber Profile Picture
    11,633 on at

    Any pointers in regards to transformation like in my case? Any docs or blogs that I can refer to ?

  • Verified answer
    Martin Dráb Profile Picture
    237,926 Most Valuable Professional on at

    Try Adding New Element using XSLT, for instance. One of the first links I got by a search engine.

  • syed baber Profile Picture
    11,633 on at

    Hi Martin,

    Quick question. I used the link provided above and created an XSLT file based on our requirements to insert the missing tag in the XML if it is non-existent, but as soon as I click on Apply transforms button, it gives me below error:

    Record for Id - J5KOBG3UJ not found.

    The above message doesn't tell me anything about the error and I have no clue what could be missing in the XSLT file. Any idea, how can I troubleshoot this ?

    Thanks,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 559 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 464 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans