1

I am new to salesforce and have a requirement and want to know, how to approach towards it.

There are three custom objects "Websites_c" , "Users_c" & "Staus_c"

In Websites_c, I have one custom field and it’s having lookup relationship to "users_c" object.

Now, once the records are added to these two custom fields, I want to display the result in the third custom field ("Staus_c") in a table format.

Please guide me with this issue and how I approach to this kind on scenario.

2
  • is status object connected to the 2 objects? and the fields are they of same data type? n r u jus displaying the data like ui or want to save it in the 3rd object? Apr 1, 2015 at 12:54
  • Thank you for response and sorry for incorrect details.No the "status" object is not connected to other objects. yes the fields are of same data type. I m just trying to display the data on status object in a table format. Anyone adding the data in this two objects, it shd automatically display in status obj. Apr 1, 2015 at 15:54

1 Answer 1

2

Adding a new ans don't have an option to reply to the previous comment. For your requirement, one approach could be as follows:

Create a trigger on Website object as it is the child in the lookup relation. This trigger would run for after insert instances so that only when the record is successfully saved, will you create a record for status object.

you'll have to query and get the record from user object using the relationship field. then create an instance for status object and when the trigger runs copy the relevant field data in the status object. And then insert the status record.

some best practices for trigger: Don't execute dml operations or queries in for loop. And try to bulkify the trigger.

Would suggest you give it a try and let me know if it works. if not then could work on the code. any doubt let know.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .