I have created two entities, otherIncome and bonus, with a one-to-many relationship between them. I want to automatically set the assignedUser on the right side to be the same as the assignedUser of the corresponding otherIncome record when I create a new bonus record. How can I achieve this?
Announcement
Collapse
No announcement yet.
how to automatically set the assignedUser same as the parents?
Collapse
X
-
Hey,
Add this to the formula of the bonus entity under administration > Entity Manager > Bonus > Formula > Before Save Custom Script
PHP Code:if (entity\isNew() && otherIncomeId && otherIncome.assignedUserId) {
assignedUserId = otherIncome.assignedUserId
}
Make sure that the name otherIncome matche the name of the link field on bonus.Rabii
Web Dev
Comment