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

What is the correct and efficient way to get the Name of the OwnerId of a Case Object?

I am trying to optimize some of our s-controls, and one of the worst ones so far is a custom object that relates to cases, which then ties the OwnerId to the Name of the User/Queue.  This is being run against a large number of cases and it takes about 10 minutes to run today.  Is there a way to query the Names of the owners from the Case Id and access the result directly?  I know there are relationship queries and I might be able to access the values I need through that but I have not played with that yet and I havent seen helpful documentation on it.  If anyone has a link to the document that covers relationships or knows a more efficient way than grabbing the Ids and looping through the different objects to get what I need it would be great to hear about it.
Using the production Ajax Toolkit and releationship query will make
your S-Control faster.

You can find the docs for Ajax Toolkit here.

The best way to get started on relationship query is to use Ajax Tools
to generate a Sample SControl for your relationship query.

Here are the steps:

1. Install the app
2. Click the explorer icon
3. Select SObject.
4. Construct relationship query by selecting the fields from the tree
5. Click the "Generate Sample" button.

This will generate an SControl that shows how to make the query call
and how to get the fields from the query result.