function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jwickettjwickett 

Check if row has any child records

Hi guys,

How do I check if an object's row has any related child records when the child records point to the master object? What is the best solution to tackle this problem (Apex, validation rules, etc...)? For example, I want a custom object called "musicians", and I want to assign a type of music to each musician (ie- "country", "rock", etc... all of which are stored as rows in another custom object). Before each musician enters an approval process, how would i check to see if in fact a type of music has already been assigned to the musician if the type of musician object is storing the ID of the musician it refers to?

I guess what i'm trying to figure out is if a master object (like musicians) is considered "updated" after a child object (like type of music) relates to it.

Thanks in advance,

Justin

Message Edited by jwickett on 07-27-2008 09:08 PM
Greg HGreg H
A master record is not considered updated when a child record related to it is updated. You could try using a rollup field on the master to get what you need or you may be able to use an Apex trigger to update the master when child is edited.
-greg
jwickettjwickett
Thanks Greg,

I ended up just associating an Apex trigger with the child object, such that now when the child object is inserted, updated, deleted, or undeleted, i update the parent's information from the child object and update the parent accordingly.


Message Edited by jwickett on 07-30-2008 03:49 PM
hsd ssdshsd ssds
There is an app at the AppExchange via MediaFrames 360 that gives streaming films and track within Salesforce.Com, that may be uncovered to other portals as well (as in keeping with the publisher link (https://hanumanchalisalyrics.net/hanuman-pooja-mantra/)). You may also want to discover it similarly: