RE: How to add in-direct related Records to a sub-grid on a form.
Hi,
Above explanation seems little confusion in terms of relationships you explained. So, I am giving you 2 possible scenarios
Scenario 1 : If A to B is N to 1 that means A will have B lookup(B will have A sub-grid). B to C is 1 to N that means C will have B lookup(B will have C sub-grid).
You need to create A lookup field on C entity to add C sub-grid on A form
You can trigger a plugin on create of A or on update of B lookup field on the A form and retrieve all the B associated C records. Then, update all the retrieved C records with target details in A lookup as EntityReferance (i.e all C records related to B must be filled with target A in the lookup). This way you can auto populate the C records in sub-grid on A form.
Scenario 2 : If A has B lookup i.e N to 1 and B has C lookup i.e N to 1
Then, you can create a lookup of C on A and just write javascript on change of B to populate C lookup or you can go for system workflow to populate the same on create/update(server side action)
Hope, Scenario 1 is what you are looking for, let me know if my understanding differs.
Please note you can't add sub-grid on forms without a relationship in place. If in case you want to display records in sub-grid without relationship then you should go for Custom HTML page.