How do I access a complex object that is within a BDM object from a form?

I just want to start with the fact that I am completely new to Bonita so I apologize in advance for any errors in my terminology. If I need to clarify anything please let me know.

I have a BDM object called IncidentTopic which contains elements called name, description and a reference called prod_info, to another BDM object called ProductInfo. The BDM object ProductInfo contains elements called global_name and type. I have a business variable called incidentTopic of type IncidentTopic. My instantiation form is successfully populating the database with all of the information including a correct reference to the selected ProductInfo. However, when I try to populate a form for a human task that allows a person to review/edit the request I can’t seem to get access to the prod_info element of the IncidentTopic. I am currently accessing the IncidentTopic data through a variable I defined in the form editor with the following attributes:
Name: incidentTopicBDM
Type: External API
Value: …/{{context.incidentTopic_ref.link}}

I am successfully getting the values for incidentTopicBDM.name and incidentTopicBDM.description but the values for incidentTopicBDM.prod_info.global_name and incidentTopicBDM.prod_info.type are blank.

When I look at the response to the REST call to get incidentTopicBDM I can see name and description in the JSON object but for the prod_info it is listed in an array called links which is a JSON object with elements called rel and href. If I directly call the href in the link for prod_info I get back the correct information for the selected product. So I am pretty sure that my issue is that I’m not using the correct syntax to get the prod_info.global_name and prod_info.type. How do I access those data to populate some text fields?

Thanks

This is because you are lazy! Well, your BDM composition is at least :wink:

Check lazy vs eager loading from this documentation page and it should make better sense!

Thank you Pierrick,

Switching from lazy to eager works. Just for future reference for anybody else who may end up reading this question, I also came up with a solution that works even with lazy loading.
I created a form variable called prod_info_incident_topic_link_index of type Javascript. The Javascript code for this variable is:

function getProdInfoIndex () {
var index = 0;

$data.incidentTopicBDM.links.forEach (function (d, i){
    if (d.rel === "prod_info") {
        index = i;
    }
});

return index;

}

return getProdInfoIndex();

I then created a form variable of type external API called product_info with a URL of …/{{incidentTopicBDM.links[prod_info_incident_topic_link_index].href}}. This returns the correct product info object that is associated with the incident.