0

Hi friends i'm new to development i got a requirement like to get account owner names and opportunities owner names from cases.So i tried to write a soql query to get for specific record type in cases.

So sample query like

SELECT Id,Account.owner.name,RecordTypeId FROM Case where RecordTypeId ='01290000001HpJp'

But my problem is how to get both opportunity owners names and account owners names in a single soql query.

  • Is your case linked to opportunity ? Do you have an opportunity lookup to case ? – Mohith Shrivastava May 17 '16 at 17:57
  • An account can have multiple opportunities .How would you know which opportunity owner you need – Mohith Shrivastava May 17 '16 at 17:59
  • Ya i know we filtered the opportunities based on some fields.But i want to know how to retrieve owner names right now. @MohithShrivastava – Pavan tej May 17 '16 at 18:01
  • 1
    The question is whether or not you have some way of indicating a particular Opportunity on the Case record. Do you have a lookup field on the Case object that allows you to indicate an Opportunity or are you relying on the Account field to then get all of the owner names for all the Opportunities associated with that Account? – sfdcJameson May 17 '16 at 18:38
  • 1
    Exhorting us that you need help now is not very polite. Telling us that you have to follow requirements and can't change that they conflict doesn't help either. You need to resolve the conflict pointed out by @Mohith before anyone can help you. One common scheme would be to use the newest record, but it's not a question we can answer for you. – Adrian Larson May 17 '16 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.