Skip to main content

Is it possible to access child relationship through merge syntax? I have tried a few variations with no success. I am trying to write the value from the child relationship to a new object.

The last attempt looks like this:

{{$Model.NYItemMaster.data.0.SCMC_InventoryItems__r.SCMC__Condition_Code__r}}

To get a field off of a particular child relationship record:

{{$Model.NYItemMaster.data.0.SCMC_InventoryItems__r.records.0.SCMC__Condition_Code__r}}


I tried what you suggested but I have not been able to get it to fill in the condition code field. 

I have a model entitled NYItemMaster from this model I want to copy certain values to a sales order lines model.

NYItemMasters has a child relationship to Inventory_Items. There is a condition code lookup field in Inventory Items to an object condition code. I need to copy that value to the SalesOrderLines model.

Sales Order Lines has a field entitled condition code that looks up to the same condition code object. 

So far I can not get this to work through the child relationship with the merge syntax provided. Can you see what I am doing wrong?

Here is what my code currently looks like:


{{$Model.NYItemMaster.data.0.SCMC_InventoryItems__r.<b>records.0.</b>SCMC__Condition_Code__r.Id}} 

Thank you for any light you can shed.


Did you actually request the SCMC__Condition_Code__r.Id field on your Child Relationship fields? Try just getting the Condition Code lookup field value itself, assuming that you’ve added SCMC__Condition_Code__c to the list of fields requested for your Child Relationship:

{{$Model.NYItemMaster.data.0.SCMC_InventoryItems__r.records.0.SCMC__Condition_Code__c}}


Zach,

Thank you for your reply. The issue was what I was trying to access not how. I had to access the information in another way. 

Thank you for letting me know how to access the child relationship fields. This will be helpful in the future.


Zach,
I want to display multiple records of the parent in a table. I want to display a field of the first child record (row 0) from EACH of the parent records as a template field in the table. When I use your formula above, it works, but it loses the context of the parent row so I only get the first child row of the FIRST PARENT record. How can I get it to hold context so that each parent row displays the first child record of that parent?


Disregard. I got it. Continuing with Tami’s use case, the formula would be:
{{SCMC_InventoryItems__r.records.0.SCMC__Condition_Code__c}}