SELECT opportunities AND contacts AND tasks












1















o See all opportunities (where field isclosed = false), contacts
and tasks (where field isclosed = false) related to the account.



I Have This Select



Select Id, 
(Select Id, WhoId FROM Tasks WHERE IsClosed = false),
(SELECT Id, AccountId FROM Contact WHERE IsClosed = false)
FROM Opportunity
WHERE IsClosed = false


I need to add contacts to the query but the semi join error "




false), (SELECT Id, AccountId FROM Contact WHERE IsClosed = false)
^
ERROR at Row:1:Column:93
Didn't understand relationship 'Contact' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names."











share|improve this question









New contributor




Helpme is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    1















    o See all opportunities (where field isclosed = false), contacts
    and tasks (where field isclosed = false) related to the account.



    I Have This Select



    Select Id, 
    (Select Id, WhoId FROM Tasks WHERE IsClosed = false),
    (SELECT Id, AccountId FROM Contact WHERE IsClosed = false)
    FROM Opportunity
    WHERE IsClosed = false


    I need to add contacts to the query but the semi join error "




    false), (SELECT Id, AccountId FROM Contact WHERE IsClosed = false)
    ^
    ERROR at Row:1:Column:93
    Didn't understand relationship 'Contact' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names."











    share|improve this question









    New contributor




    Helpme is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      1












      1








      1








      o See all opportunities (where field isclosed = false), contacts
      and tasks (where field isclosed = false) related to the account.



      I Have This Select



      Select Id, 
      (Select Id, WhoId FROM Tasks WHERE IsClosed = false),
      (SELECT Id, AccountId FROM Contact WHERE IsClosed = false)
      FROM Opportunity
      WHERE IsClosed = false


      I need to add contacts to the query but the semi join error "




      false), (SELECT Id, AccountId FROM Contact WHERE IsClosed = false)
      ^
      ERROR at Row:1:Column:93
      Didn't understand relationship 'Contact' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names."











      share|improve this question









      New contributor




      Helpme is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      o See all opportunities (where field isclosed = false), contacts
      and tasks (where field isclosed = false) related to the account.



      I Have This Select



      Select Id, 
      (Select Id, WhoId FROM Tasks WHERE IsClosed = false),
      (SELECT Id, AccountId FROM Contact WHERE IsClosed = false)
      FROM Opportunity
      WHERE IsClosed = false


      I need to add contacts to the query but the semi join error "




      false), (SELECT Id, AccountId FROM Contact WHERE IsClosed = false)
      ^
      ERROR at Row:1:Column:93
      Didn't understand relationship 'Contact' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names."








      multi-select semi-join






      share|improve this question









      New contributor




      Helpme is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Helpme is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 18 hours ago









      David Cheng

      2,37141845




      2,37141845






      New contributor




      Helpme is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked yesterday









      HelpmeHelpme

      61




      61




      New contributor




      Helpme is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Helpme is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Helpme is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes


















          5














          The part of your query where you're saying (Select Id, WhoId FROM Tasks WHERE IsClosed = false) is known as a Left Outer Join, or a Parent-Child Subquery. A semi-join is similar, but different (a semi-join is a subquery in the WHERE clause, not the SELECT clause).



          In those subqueries, the name of the object you're targeting changes. You need to use the child relationship name. From Understanding Relationship Names (emphasis mine)




          For parent-to-child relationships, the parent object has a name for the child relationship that is unique to the parent, the plural of the child object name. For example, Account has child relationships to Assets, Cases, and Contacts among other objects, and has a relationshipName for each, Assets, Cases, and Contacts. These relationships can be traversed only in the SELECT clause, using a nested SOQL query. For example:



          SELECT Account.Name, (SELECT Contact.FirstName, Contact.LastName FROM Account.Contacts) FROM Account



          This query returns all accounts, and for each account, the first and last name of each contact associated with (the child of) that account.




          The "plural of the child object name" rule doesn't hold in all cases. Custom relationships can have almost any child relationship name, and some standard relationships don't follow that rule.



          e.g. if you have the "allow Contacts to be related to multiple Accounts" feature enabled, you get the AccountContactRelationship object. This object has two, standard master-detail relationship fields (one to Account, and one to Contact). If you're doing a parent-child subquery for this object from, let's say, Account, the child relationship name is AccountContactRelations instead of the AccountContactRelationships that we would expect.



          In your case though, you have it easy. The child relationship name for Contact is Contacts. Simply add that 's' onto the end of the object name in that one subquery, and you should be fine.



          +edit:



          As Sebastian Kessel pointed out the isClosed field does not exist on the Contact object. While not cited as the cause of the error you're seeing, this would be the cause of the next error message you would see.






          share|improve this answer





















          • 1





            Is ‘isClosed’ a field in the Contacts object? That might be another failure.

            – Sebastian Kessel
            18 hours ago











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "459"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Helpme is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f249717%2fselect-opportunities-and-contacts-and-tasks%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5














          The part of your query where you're saying (Select Id, WhoId FROM Tasks WHERE IsClosed = false) is known as a Left Outer Join, or a Parent-Child Subquery. A semi-join is similar, but different (a semi-join is a subquery in the WHERE clause, not the SELECT clause).



          In those subqueries, the name of the object you're targeting changes. You need to use the child relationship name. From Understanding Relationship Names (emphasis mine)




          For parent-to-child relationships, the parent object has a name for the child relationship that is unique to the parent, the plural of the child object name. For example, Account has child relationships to Assets, Cases, and Contacts among other objects, and has a relationshipName for each, Assets, Cases, and Contacts. These relationships can be traversed only in the SELECT clause, using a nested SOQL query. For example:



          SELECT Account.Name, (SELECT Contact.FirstName, Contact.LastName FROM Account.Contacts) FROM Account



          This query returns all accounts, and for each account, the first and last name of each contact associated with (the child of) that account.




          The "plural of the child object name" rule doesn't hold in all cases. Custom relationships can have almost any child relationship name, and some standard relationships don't follow that rule.



          e.g. if you have the "allow Contacts to be related to multiple Accounts" feature enabled, you get the AccountContactRelationship object. This object has two, standard master-detail relationship fields (one to Account, and one to Contact). If you're doing a parent-child subquery for this object from, let's say, Account, the child relationship name is AccountContactRelations instead of the AccountContactRelationships that we would expect.



          In your case though, you have it easy. The child relationship name for Contact is Contacts. Simply add that 's' onto the end of the object name in that one subquery, and you should be fine.



          +edit:



          As Sebastian Kessel pointed out the isClosed field does not exist on the Contact object. While not cited as the cause of the error you're seeing, this would be the cause of the next error message you would see.






          share|improve this answer





















          • 1





            Is ‘isClosed’ a field in the Contacts object? That might be another failure.

            – Sebastian Kessel
            18 hours ago
















          5














          The part of your query where you're saying (Select Id, WhoId FROM Tasks WHERE IsClosed = false) is known as a Left Outer Join, or a Parent-Child Subquery. A semi-join is similar, but different (a semi-join is a subquery in the WHERE clause, not the SELECT clause).



          In those subqueries, the name of the object you're targeting changes. You need to use the child relationship name. From Understanding Relationship Names (emphasis mine)




          For parent-to-child relationships, the parent object has a name for the child relationship that is unique to the parent, the plural of the child object name. For example, Account has child relationships to Assets, Cases, and Contacts among other objects, and has a relationshipName for each, Assets, Cases, and Contacts. These relationships can be traversed only in the SELECT clause, using a nested SOQL query. For example:



          SELECT Account.Name, (SELECT Contact.FirstName, Contact.LastName FROM Account.Contacts) FROM Account



          This query returns all accounts, and for each account, the first and last name of each contact associated with (the child of) that account.




          The "plural of the child object name" rule doesn't hold in all cases. Custom relationships can have almost any child relationship name, and some standard relationships don't follow that rule.



          e.g. if you have the "allow Contacts to be related to multiple Accounts" feature enabled, you get the AccountContactRelationship object. This object has two, standard master-detail relationship fields (one to Account, and one to Contact). If you're doing a parent-child subquery for this object from, let's say, Account, the child relationship name is AccountContactRelations instead of the AccountContactRelationships that we would expect.



          In your case though, you have it easy. The child relationship name for Contact is Contacts. Simply add that 's' onto the end of the object name in that one subquery, and you should be fine.



          +edit:



          As Sebastian Kessel pointed out the isClosed field does not exist on the Contact object. While not cited as the cause of the error you're seeing, this would be the cause of the next error message you would see.






          share|improve this answer





















          • 1





            Is ‘isClosed’ a field in the Contacts object? That might be another failure.

            – Sebastian Kessel
            18 hours ago














          5












          5








          5







          The part of your query where you're saying (Select Id, WhoId FROM Tasks WHERE IsClosed = false) is known as a Left Outer Join, or a Parent-Child Subquery. A semi-join is similar, but different (a semi-join is a subquery in the WHERE clause, not the SELECT clause).



          In those subqueries, the name of the object you're targeting changes. You need to use the child relationship name. From Understanding Relationship Names (emphasis mine)




          For parent-to-child relationships, the parent object has a name for the child relationship that is unique to the parent, the plural of the child object name. For example, Account has child relationships to Assets, Cases, and Contacts among other objects, and has a relationshipName for each, Assets, Cases, and Contacts. These relationships can be traversed only in the SELECT clause, using a nested SOQL query. For example:



          SELECT Account.Name, (SELECT Contact.FirstName, Contact.LastName FROM Account.Contacts) FROM Account



          This query returns all accounts, and for each account, the first and last name of each contact associated with (the child of) that account.




          The "plural of the child object name" rule doesn't hold in all cases. Custom relationships can have almost any child relationship name, and some standard relationships don't follow that rule.



          e.g. if you have the "allow Contacts to be related to multiple Accounts" feature enabled, you get the AccountContactRelationship object. This object has two, standard master-detail relationship fields (one to Account, and one to Contact). If you're doing a parent-child subquery for this object from, let's say, Account, the child relationship name is AccountContactRelations instead of the AccountContactRelationships that we would expect.



          In your case though, you have it easy. The child relationship name for Contact is Contacts. Simply add that 's' onto the end of the object name in that one subquery, and you should be fine.



          +edit:



          As Sebastian Kessel pointed out the isClosed field does not exist on the Contact object. While not cited as the cause of the error you're seeing, this would be the cause of the next error message you would see.






          share|improve this answer















          The part of your query where you're saying (Select Id, WhoId FROM Tasks WHERE IsClosed = false) is known as a Left Outer Join, or a Parent-Child Subquery. A semi-join is similar, but different (a semi-join is a subquery in the WHERE clause, not the SELECT clause).



          In those subqueries, the name of the object you're targeting changes. You need to use the child relationship name. From Understanding Relationship Names (emphasis mine)




          For parent-to-child relationships, the parent object has a name for the child relationship that is unique to the parent, the plural of the child object name. For example, Account has child relationships to Assets, Cases, and Contacts among other objects, and has a relationshipName for each, Assets, Cases, and Contacts. These relationships can be traversed only in the SELECT clause, using a nested SOQL query. For example:



          SELECT Account.Name, (SELECT Contact.FirstName, Contact.LastName FROM Account.Contacts) FROM Account



          This query returns all accounts, and for each account, the first and last name of each contact associated with (the child of) that account.




          The "plural of the child object name" rule doesn't hold in all cases. Custom relationships can have almost any child relationship name, and some standard relationships don't follow that rule.



          e.g. if you have the "allow Contacts to be related to multiple Accounts" feature enabled, you get the AccountContactRelationship object. This object has two, standard master-detail relationship fields (one to Account, and one to Contact). If you're doing a parent-child subquery for this object from, let's say, Account, the child relationship name is AccountContactRelations instead of the AccountContactRelationships that we would expect.



          In your case though, you have it easy. The child relationship name for Contact is Contacts. Simply add that 's' onto the end of the object name in that one subquery, and you should be fine.



          +edit:



          As Sebastian Kessel pointed out the isClosed field does not exist on the Contact object. While not cited as the cause of the error you're seeing, this would be the cause of the next error message you would see.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 13 hours ago

























          answered 23 hours ago









          Derek FDerek F

          19.6k32052




          19.6k32052








          • 1





            Is ‘isClosed’ a field in the Contacts object? That might be another failure.

            – Sebastian Kessel
            18 hours ago














          • 1





            Is ‘isClosed’ a field in the Contacts object? That might be another failure.

            – Sebastian Kessel
            18 hours ago








          1




          1





          Is ‘isClosed’ a field in the Contacts object? That might be another failure.

          – Sebastian Kessel
          18 hours ago





          Is ‘isClosed’ a field in the Contacts object? That might be another failure.

          – Sebastian Kessel
          18 hours ago










          Helpme is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Helpme is a new contributor. Be nice, and check out our Code of Conduct.













          Helpme is a new contributor. Be nice, and check out our Code of Conduct.












          Helpme is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Salesforce Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f249717%2fselect-opportunities-and-contacts-and-tasks%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to label and detect the document text images

          Vallis Paradisi

          Tabula Rosettana