AnsweredAssumed Answered

What is the best way to add custom fields to relatedAttributes when creating a record from subpanel?

Question asked by Francesca Shiekh on Jan 13, 2015
Latest reply on Jan 16, 2015 by Gustav Lindström
Example: On the Accounts Module we have affiliation_c, a custom field.
When creating an Opportunity from the subpanel on Accounts I want to copy the affiliation_c from Accounts to the affiliation_c on Opportunities (in other examples the field names don't necessarily match and I need solutions for that too).

In 6.5.x I would get the info in the Opportunities view.edit.php check the parent type, retrie the Account bean, copy the necessary fields to the Opportunities bean.

What is the best way to do this in v7?

One option could be to add to the initialize, get the account bean and set 

              this.model.relatedAttributes for affiliation_c to that of the account. 
(Assuming I can get the bean etc before the render kicks in else I'll need to re-render).

Is this the best way?

thanks,
FrancescaS

Outcomes