Expand my Community achievements bar.

How to add optional association or a 0 to many association in FDM

Avatar

Level 2

Hi all,

I am currently working on a form data model which is using Microsoft CRM as a data source.

I am trying to define an association between 2 entities, however, the only options available in the editor are a One to One association and a One to Many association.

I am able to define a One to One association, however, it throws an error if the value for the NavigationProperty is unavailable.

A short summary of my current scenario below,

In CRM, I have an entity let's say A, which contains a field (assume field_A) which is a lookup to another entity B.

But the field (field_A) is not a mandatory field in CRM, hence, it might not hold a reference to B always.

However, whenever it does contain a value, I want to retrieve its corresponding details from entity B.

If I define a One to One association in AEM FDM, it throws a null pointer exception when the record doesn't contain a reference and doesn't return data for the entire data model instead of just not returning the corresponding data for that association. But if the reference is available, then it returns the data correctly. I even tried to remove the Mandatory option for the navigation property and test it, however, there is no change in the behaviour.

Tracing the logs, I noticed that the association is being executed regardless of the availability of the data, which throws an exception. Is there a way to configure the FDM in such a way that the association call is only triggered if there is a value available for the binding property?

4 Replies

Avatar

Employee Advisor

I think this is something on expected lines, can the CRM not return a default value like NA when the data is unavailable?

Avatar

Level 2

Unfortunately, that is not an option within CRM without changing the system behaviour itself. At least, that is what our CRM specialists say. Is there an option to customize the behaviour of the OOB FDM?

Avatar

Employee Advisor

Hi Rakesh,

I think you have logged a ticket for this as well. Can you confirm the ticket no,?