Skip to main content
1 of 2
arut
  • 5.4k
  • 2
  • 13
  • 30

Problem lies in this line this.targetEvt = data[0].Targets__r.Main_Target__c. It should be this.targetEvt = i.Main_Target__c.

Datatype of data[0].Targets__r is an array. So, trying access the property of an array element directly from an array doesn't make sense. You are already using a for loop where i represents elements in the array (for Targets__r), so you should use i.Main_Target__c.

If you need the first element value of the child array, you can change the code to data[0].Targets__r[0].Main_Target__c and skip the for loop.

arut
  • 5.4k
  • 2
  • 13
  • 30