0
votes

I have two custom objects 'User Name' and 'Salary'. There is a lookup relationship between the two objects. For every User Name, there are many salary records. I want one field,that is, 'Available Salary' to be there which adds the 'Net Salary' records from all the salary records for a particular user. Should I make this field in User Name?? Please tell me the formula for this and in which object should I make this field??

1

1 Answers

2
votes

If you were prepared to change the lookup relationship to be master/detail, then you'd be able to create a roll up summary field on the UserName object that calculated the sum of the child records. If it has to be a lookup, then i think you're only choice would be to write a apex trigger to update the userName object.