Are the related objects in an SOQL query shared?SOQL results returning RecordTypeId which is not included in querySOQL Query Limit and Data LoadingSOQL join query between child-parent related objectsSOQL Best Practices with Multiple Junction Objectshow to read all Content Notes saved as 'SNote' (Beta New Notes feature) for a Parent record all users?What are the criteria for being able to set object related data in memory?Querying related objectsSOQL Query for Related Custom ObjectsSOQL Query Limits in Wrapper Class (using dlrs)What deep magic exists in Apex and can we replicate it?Related List SOQL query

How to check a file was encrypted (really & correctly)

How does Rust's 128-bit integer `i128` work on a 64-bit system?

Would the shaking of an earthquake be visible to somebody in a low-flying aircraft?

How to open Lightning component in new window

Should I use (1,3) or (1-3) or (4)?

Write The Shortest Program to Calculate Height of a Binary Tree

The warlock of firetop mountain, what's the deal with reference 192?

Why did the US Airways Flight 1549 passengers stay on the wings?

Generate random number in Unity without class ambiguity

How to win against ants

Why is Heisenberg shown dead in Negro y Azul?

Pronouns when writing from the point of view of a robot

foot-pounds of energy?

What license to choose for my PhD thesis?

Is the first page of a novel really that important?

Getting Lost in the Caves of Chaos

A Checkmate of Dubious Legality

Why do dragons like shiny stuff?

Plotting Autoregressive Functions / Linear Difference Equations

conditional probability of dependent random variables

How can I perform a deterministic physics simulation?

If someone else uploads my GPL'd code to Github without my permission, is that a copyright violation?

The Game of the Century - why didn't Byrne take the rook after he forked Fischer?

Is there a way to say "double + any number" in German?



Are the related objects in an SOQL query shared?


SOQL results returning RecordTypeId which is not included in querySOQL Query Limit and Data LoadingSOQL join query between child-parent related objectsSOQL Best Practices with Multiple Junction Objectshow to read all Content Notes saved as 'SNote' (Beta New Notes feature) for a Parent record all users?What are the criteria for being able to set object related data in memory?Querying related objectsSOQL Query for Related Custom ObjectsSOQL Query Limits in Wrapper Class (using dlrs)What deep magic exists in Apex and can we replicate it?Related List SOQL query






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








6















I have an SOQL query between two custom objects, let's call them A__c and B__c, where A__c has a Lookup field called B__c that references a B__c instance and B__c has two fields X__c and Y__c like:



SELECT Id, B__r.Id, B__r.X__c, B__r.Y__c FROM A__c


When I have instances of B__c "shared" between the queried instances of A__c, i.e. where multiple A__c instances refer to the same B__c instance(s), does each A__c have its own copy of the related B__c or is SOQL smart enough to optimize the B__c instances so two or more returned A__c's actually use the same in-memory B__c as needed?



Empirically, it appears that the common B__c instances are actually shared (I can update the B__c instances obtained via A__c.B__r in different ways, based on other A__c values, and get the expected results). However, I can't find any official documentation about this. Can anyone point me to some documentation that states this as expected behaviour?










share|improve this question






























    6















    I have an SOQL query between two custom objects, let's call them A__c and B__c, where A__c has a Lookup field called B__c that references a B__c instance and B__c has two fields X__c and Y__c like:



    SELECT Id, B__r.Id, B__r.X__c, B__r.Y__c FROM A__c


    When I have instances of B__c "shared" between the queried instances of A__c, i.e. where multiple A__c instances refer to the same B__c instance(s), does each A__c have its own copy of the related B__c or is SOQL smart enough to optimize the B__c instances so two or more returned A__c's actually use the same in-memory B__c as needed?



    Empirically, it appears that the common B__c instances are actually shared (I can update the B__c instances obtained via A__c.B__r in different ways, based on other A__c values, and get the expected results). However, I can't find any official documentation about this. Can anyone point me to some documentation that states this as expected behaviour?










    share|improve this question


























      6












      6








      6


      3






      I have an SOQL query between two custom objects, let's call them A__c and B__c, where A__c has a Lookup field called B__c that references a B__c instance and B__c has two fields X__c and Y__c like:



      SELECT Id, B__r.Id, B__r.X__c, B__r.Y__c FROM A__c


      When I have instances of B__c "shared" between the queried instances of A__c, i.e. where multiple A__c instances refer to the same B__c instance(s), does each A__c have its own copy of the related B__c or is SOQL smart enough to optimize the B__c instances so two or more returned A__c's actually use the same in-memory B__c as needed?



      Empirically, it appears that the common B__c instances are actually shared (I can update the B__c instances obtained via A__c.B__r in different ways, based on other A__c values, and get the expected results). However, I can't find any official documentation about this. Can anyone point me to some documentation that states this as expected behaviour?










      share|improve this question














      I have an SOQL query between two custom objects, let's call them A__c and B__c, where A__c has a Lookup field called B__c that references a B__c instance and B__c has two fields X__c and Y__c like:



      SELECT Id, B__r.Id, B__r.X__c, B__r.Y__c FROM A__c


      When I have instances of B__c "shared" between the queried instances of A__c, i.e. where multiple A__c instances refer to the same B__c instance(s), does each A__c have its own copy of the related B__c or is SOQL smart enough to optimize the B__c instances so two or more returned A__c's actually use the same in-memory B__c as needed?



      Empirically, it appears that the common B__c instances are actually shared (I can update the B__c instances obtained via A__c.B__r in different ways, based on other A__c values, and get the expected results). However, I can't find any official documentation about this. Can anyone point me to some documentation that states this as expected behaviour?







      soql relationships in-memory






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 8 hours ago









      Phil WPhil W

      2,7401 gold badge3 silver badges12 bronze badges




      2,7401 gold badge3 silver badges12 bronze badges























          2 Answers
          2






          active

          oldest

          votes


















          6















          Can anyone point me to some documentation that states this as expected behaviour?




          I've never seen such documentation.




          Empirically, it appears that the common B__c instances are actually shared (I can update the B__c instances obtained via A__c.B__r in different ways, based on other A__c values, and get the expected results).




          This is definitely true; I was able to verify this in my developer edition using ===, which compares memory addresses rather than contents:



          Contact[] records = [select account.name from contact where account.name = 'demo'];
          system.assert(records[0].account === records[1].account);


          However, without documentation, we cannot rely on this behavior. At this point, someone should probably open a case with support. Either the documentation should be updated (thus ensuring we have a guarantee), or the behavior should actually be changed, because this could have unintended consequences for developers that try to do "clever" things with those records.



          While I'm glad that Apex is saving us some memory (heap is really easy to fill up), undocumented behavior could be dangerous. I've never seen this behavior before, but I can envision some sort of algorithm that uses the account records for several different fields and ends up having invalid data because of this shared object behavior.






          share|improve this answer

























          • Exactly why I asked the question. I'd be very happy if you could open the support case if you are able - my company doesn't have the right type of support agreement for me to do so. :)

            – Phil W
            8 hours ago












          • Another small item I noticed - even when I don't request for the related object's IDs, these get populated. Not spotted documentation about this one either.

            – Phil W
            7 hours ago






          • 1





            @PhilW Yes, I've covered this in a previous answer. The theory is that Visualforce needs these extra fields to make sure things don't break in interesting ways.

            – sfdcfox
            7 hours ago


















          0














          In Understanding Query Results, it says:




          Query results are returned as nested objects. The primary or “driving” object of the main SELECT statement in a SOQL query contains query results of subqueries.




          I didnt find much of other documentation on this, I have been using this kind of behaviour of SOQL from a long time.



          For example, consider below SOQL:



          System.debug(JSON.serialize([SELECT Name, Account.Name, Account.Phone, Account.AccountNumber 
          FROM Contact
          WHERE Id='XXXXXXXXXSJQA0']));


          The debug you get will be as below:



          [

          "attributes":
          "type": "Contact",
          "url": "/services/data/v46.0/sobjects/Contact/0030K00001yZ4SJQA0"
          ,
          "Name": "Some mrs with POC",
          "AccountId": "XXXXXXXXX45qAAA",
          "Id": "XXXXXXXXXZ4SJQA0",
          "RecordTypeId": "XXXXXXXXX1I4LeQAK",
          "Account":
          "attributes":
          "type": "Account",
          "url": "/services/data/v46.0/sobjects/Account/XXXXXXX45qAAA"
          ,
          "Id": "XXXXXXXXX5qAAA",
          "Name": "United Oil & Gas Corp.123",
          "Phone": "(212) 842-5500",
          "AccountNumber": "CD355118"


          ]


          This clearly shows that SOQL intelligently gets single instance of parent object with all fields. This has some advantages where you can update the parent object as below:



          Contact cnt = [SELECT Name, Account.Name, Account.Phone, Account.AccountNumber 
          FROM Contact
          WHERE Id='0030K00001yZ4SJQA0'];

          cnt.Account.Name = cnt.Account.Name + 'Changed';
          cnt.Account.Phone = '1111111111';
          update cnt.Account;


          This way of processing saves additional SQOL queries and code.






          share|improve this answer





























            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
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f272390%2fare-the-related-objects-in-an-soql-query-shared%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            6















            Can anyone point me to some documentation that states this as expected behaviour?




            I've never seen such documentation.




            Empirically, it appears that the common B__c instances are actually shared (I can update the B__c instances obtained via A__c.B__r in different ways, based on other A__c values, and get the expected results).




            This is definitely true; I was able to verify this in my developer edition using ===, which compares memory addresses rather than contents:



            Contact[] records = [select account.name from contact where account.name = 'demo'];
            system.assert(records[0].account === records[1].account);


            However, without documentation, we cannot rely on this behavior. At this point, someone should probably open a case with support. Either the documentation should be updated (thus ensuring we have a guarantee), or the behavior should actually be changed, because this could have unintended consequences for developers that try to do "clever" things with those records.



            While I'm glad that Apex is saving us some memory (heap is really easy to fill up), undocumented behavior could be dangerous. I've never seen this behavior before, but I can envision some sort of algorithm that uses the account records for several different fields and ends up having invalid data because of this shared object behavior.






            share|improve this answer

























            • Exactly why I asked the question. I'd be very happy if you could open the support case if you are able - my company doesn't have the right type of support agreement for me to do so. :)

              – Phil W
              8 hours ago












            • Another small item I noticed - even when I don't request for the related object's IDs, these get populated. Not spotted documentation about this one either.

              – Phil W
              7 hours ago






            • 1





              @PhilW Yes, I've covered this in a previous answer. The theory is that Visualforce needs these extra fields to make sure things don't break in interesting ways.

              – sfdcfox
              7 hours ago















            6















            Can anyone point me to some documentation that states this as expected behaviour?




            I've never seen such documentation.




            Empirically, it appears that the common B__c instances are actually shared (I can update the B__c instances obtained via A__c.B__r in different ways, based on other A__c values, and get the expected results).




            This is definitely true; I was able to verify this in my developer edition using ===, which compares memory addresses rather than contents:



            Contact[] records = [select account.name from contact where account.name = 'demo'];
            system.assert(records[0].account === records[1].account);


            However, without documentation, we cannot rely on this behavior. At this point, someone should probably open a case with support. Either the documentation should be updated (thus ensuring we have a guarantee), or the behavior should actually be changed, because this could have unintended consequences for developers that try to do "clever" things with those records.



            While I'm glad that Apex is saving us some memory (heap is really easy to fill up), undocumented behavior could be dangerous. I've never seen this behavior before, but I can envision some sort of algorithm that uses the account records for several different fields and ends up having invalid data because of this shared object behavior.






            share|improve this answer

























            • Exactly why I asked the question. I'd be very happy if you could open the support case if you are able - my company doesn't have the right type of support agreement for me to do so. :)

              – Phil W
              8 hours ago












            • Another small item I noticed - even when I don't request for the related object's IDs, these get populated. Not spotted documentation about this one either.

              – Phil W
              7 hours ago






            • 1





              @PhilW Yes, I've covered this in a previous answer. The theory is that Visualforce needs these extra fields to make sure things don't break in interesting ways.

              – sfdcfox
              7 hours ago













            6












            6








            6








            Can anyone point me to some documentation that states this as expected behaviour?




            I've never seen such documentation.




            Empirically, it appears that the common B__c instances are actually shared (I can update the B__c instances obtained via A__c.B__r in different ways, based on other A__c values, and get the expected results).




            This is definitely true; I was able to verify this in my developer edition using ===, which compares memory addresses rather than contents:



            Contact[] records = [select account.name from contact where account.name = 'demo'];
            system.assert(records[0].account === records[1].account);


            However, without documentation, we cannot rely on this behavior. At this point, someone should probably open a case with support. Either the documentation should be updated (thus ensuring we have a guarantee), or the behavior should actually be changed, because this could have unintended consequences for developers that try to do "clever" things with those records.



            While I'm glad that Apex is saving us some memory (heap is really easy to fill up), undocumented behavior could be dangerous. I've never seen this behavior before, but I can envision some sort of algorithm that uses the account records for several different fields and ends up having invalid data because of this shared object behavior.






            share|improve this answer














            Can anyone point me to some documentation that states this as expected behaviour?




            I've never seen such documentation.




            Empirically, it appears that the common B__c instances are actually shared (I can update the B__c instances obtained via A__c.B__r in different ways, based on other A__c values, and get the expected results).




            This is definitely true; I was able to verify this in my developer edition using ===, which compares memory addresses rather than contents:



            Contact[] records = [select account.name from contact where account.name = 'demo'];
            system.assert(records[0].account === records[1].account);


            However, without documentation, we cannot rely on this behavior. At this point, someone should probably open a case with support. Either the documentation should be updated (thus ensuring we have a guarantee), or the behavior should actually be changed, because this could have unintended consequences for developers that try to do "clever" things with those records.



            While I'm glad that Apex is saving us some memory (heap is really easy to fill up), undocumented behavior could be dangerous. I've never seen this behavior before, but I can envision some sort of algorithm that uses the account records for several different fields and ends up having invalid data because of this shared object behavior.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 8 hours ago









            sfdcfoxsfdcfox

            281k14 gold badges227 silver badges480 bronze badges




            281k14 gold badges227 silver badges480 bronze badges















            • Exactly why I asked the question. I'd be very happy if you could open the support case if you are able - my company doesn't have the right type of support agreement for me to do so. :)

              – Phil W
              8 hours ago












            • Another small item I noticed - even when I don't request for the related object's IDs, these get populated. Not spotted documentation about this one either.

              – Phil W
              7 hours ago






            • 1





              @PhilW Yes, I've covered this in a previous answer. The theory is that Visualforce needs these extra fields to make sure things don't break in interesting ways.

              – sfdcfox
              7 hours ago

















            • Exactly why I asked the question. I'd be very happy if you could open the support case if you are able - my company doesn't have the right type of support agreement for me to do so. :)

              – Phil W
              8 hours ago












            • Another small item I noticed - even when I don't request for the related object's IDs, these get populated. Not spotted documentation about this one either.

              – Phil W
              7 hours ago






            • 1





              @PhilW Yes, I've covered this in a previous answer. The theory is that Visualforce needs these extra fields to make sure things don't break in interesting ways.

              – sfdcfox
              7 hours ago
















            Exactly why I asked the question. I'd be very happy if you could open the support case if you are able - my company doesn't have the right type of support agreement for me to do so. :)

            – Phil W
            8 hours ago






            Exactly why I asked the question. I'd be very happy if you could open the support case if you are able - my company doesn't have the right type of support agreement for me to do so. :)

            – Phil W
            8 hours ago














            Another small item I noticed - even when I don't request for the related object's IDs, these get populated. Not spotted documentation about this one either.

            – Phil W
            7 hours ago





            Another small item I noticed - even when I don't request for the related object's IDs, these get populated. Not spotted documentation about this one either.

            – Phil W
            7 hours ago




            1




            1





            @PhilW Yes, I've covered this in a previous answer. The theory is that Visualforce needs these extra fields to make sure things don't break in interesting ways.

            – sfdcfox
            7 hours ago





            @PhilW Yes, I've covered this in a previous answer. The theory is that Visualforce needs these extra fields to make sure things don't break in interesting ways.

            – sfdcfox
            7 hours ago













            0














            In Understanding Query Results, it says:




            Query results are returned as nested objects. The primary or “driving” object of the main SELECT statement in a SOQL query contains query results of subqueries.




            I didnt find much of other documentation on this, I have been using this kind of behaviour of SOQL from a long time.



            For example, consider below SOQL:



            System.debug(JSON.serialize([SELECT Name, Account.Name, Account.Phone, Account.AccountNumber 
            FROM Contact
            WHERE Id='XXXXXXXXXSJQA0']));


            The debug you get will be as below:



            [

            "attributes":
            "type": "Contact",
            "url": "/services/data/v46.0/sobjects/Contact/0030K00001yZ4SJQA0"
            ,
            "Name": "Some mrs with POC",
            "AccountId": "XXXXXXXXX45qAAA",
            "Id": "XXXXXXXXXZ4SJQA0",
            "RecordTypeId": "XXXXXXXXX1I4LeQAK",
            "Account":
            "attributes":
            "type": "Account",
            "url": "/services/data/v46.0/sobjects/Account/XXXXXXX45qAAA"
            ,
            "Id": "XXXXXXXXX5qAAA",
            "Name": "United Oil & Gas Corp.123",
            "Phone": "(212) 842-5500",
            "AccountNumber": "CD355118"


            ]


            This clearly shows that SOQL intelligently gets single instance of parent object with all fields. This has some advantages where you can update the parent object as below:



            Contact cnt = [SELECT Name, Account.Name, Account.Phone, Account.AccountNumber 
            FROM Contact
            WHERE Id='0030K00001yZ4SJQA0'];

            cnt.Account.Name = cnt.Account.Name + 'Changed';
            cnt.Account.Phone = '1111111111';
            update cnt.Account;


            This way of processing saves additional SQOL queries and code.






            share|improve this answer































              0














              In Understanding Query Results, it says:




              Query results are returned as nested objects. The primary or “driving” object of the main SELECT statement in a SOQL query contains query results of subqueries.




              I didnt find much of other documentation on this, I have been using this kind of behaviour of SOQL from a long time.



              For example, consider below SOQL:



              System.debug(JSON.serialize([SELECT Name, Account.Name, Account.Phone, Account.AccountNumber 
              FROM Contact
              WHERE Id='XXXXXXXXXSJQA0']));


              The debug you get will be as below:



              [

              "attributes":
              "type": "Contact",
              "url": "/services/data/v46.0/sobjects/Contact/0030K00001yZ4SJQA0"
              ,
              "Name": "Some mrs with POC",
              "AccountId": "XXXXXXXXX45qAAA",
              "Id": "XXXXXXXXXZ4SJQA0",
              "RecordTypeId": "XXXXXXXXX1I4LeQAK",
              "Account":
              "attributes":
              "type": "Account",
              "url": "/services/data/v46.0/sobjects/Account/XXXXXXX45qAAA"
              ,
              "Id": "XXXXXXXXX5qAAA",
              "Name": "United Oil & Gas Corp.123",
              "Phone": "(212) 842-5500",
              "AccountNumber": "CD355118"


              ]


              This clearly shows that SOQL intelligently gets single instance of parent object with all fields. This has some advantages where you can update the parent object as below:



              Contact cnt = [SELECT Name, Account.Name, Account.Phone, Account.AccountNumber 
              FROM Contact
              WHERE Id='0030K00001yZ4SJQA0'];

              cnt.Account.Name = cnt.Account.Name + 'Changed';
              cnt.Account.Phone = '1111111111';
              update cnt.Account;


              This way of processing saves additional SQOL queries and code.






              share|improve this answer





























                0












                0








                0







                In Understanding Query Results, it says:




                Query results are returned as nested objects. The primary or “driving” object of the main SELECT statement in a SOQL query contains query results of subqueries.




                I didnt find much of other documentation on this, I have been using this kind of behaviour of SOQL from a long time.



                For example, consider below SOQL:



                System.debug(JSON.serialize([SELECT Name, Account.Name, Account.Phone, Account.AccountNumber 
                FROM Contact
                WHERE Id='XXXXXXXXXSJQA0']));


                The debug you get will be as below:



                [

                "attributes":
                "type": "Contact",
                "url": "/services/data/v46.0/sobjects/Contact/0030K00001yZ4SJQA0"
                ,
                "Name": "Some mrs with POC",
                "AccountId": "XXXXXXXXX45qAAA",
                "Id": "XXXXXXXXXZ4SJQA0",
                "RecordTypeId": "XXXXXXXXX1I4LeQAK",
                "Account":
                "attributes":
                "type": "Account",
                "url": "/services/data/v46.0/sobjects/Account/XXXXXXX45qAAA"
                ,
                "Id": "XXXXXXXXX5qAAA",
                "Name": "United Oil & Gas Corp.123",
                "Phone": "(212) 842-5500",
                "AccountNumber": "CD355118"


                ]


                This clearly shows that SOQL intelligently gets single instance of parent object with all fields. This has some advantages where you can update the parent object as below:



                Contact cnt = [SELECT Name, Account.Name, Account.Phone, Account.AccountNumber 
                FROM Contact
                WHERE Id='0030K00001yZ4SJQA0'];

                cnt.Account.Name = cnt.Account.Name + 'Changed';
                cnt.Account.Phone = '1111111111';
                update cnt.Account;


                This way of processing saves additional SQOL queries and code.






                share|improve this answer















                In Understanding Query Results, it says:




                Query results are returned as nested objects. The primary or “driving” object of the main SELECT statement in a SOQL query contains query results of subqueries.




                I didnt find much of other documentation on this, I have been using this kind of behaviour of SOQL from a long time.



                For example, consider below SOQL:



                System.debug(JSON.serialize([SELECT Name, Account.Name, Account.Phone, Account.AccountNumber 
                FROM Contact
                WHERE Id='XXXXXXXXXSJQA0']));


                The debug you get will be as below:



                [

                "attributes":
                "type": "Contact",
                "url": "/services/data/v46.0/sobjects/Contact/0030K00001yZ4SJQA0"
                ,
                "Name": "Some mrs with POC",
                "AccountId": "XXXXXXXXX45qAAA",
                "Id": "XXXXXXXXXZ4SJQA0",
                "RecordTypeId": "XXXXXXXXX1I4LeQAK",
                "Account":
                "attributes":
                "type": "Account",
                "url": "/services/data/v46.0/sobjects/Account/XXXXXXX45qAAA"
                ,
                "Id": "XXXXXXXXX5qAAA",
                "Name": "United Oil & Gas Corp.123",
                "Phone": "(212) 842-5500",
                "AccountNumber": "CD355118"


                ]


                This clearly shows that SOQL intelligently gets single instance of parent object with all fields. This has some advantages where you can update the parent object as below:



                Contact cnt = [SELECT Name, Account.Name, Account.Phone, Account.AccountNumber 
                FROM Contact
                WHERE Id='0030K00001yZ4SJQA0'];

                cnt.Account.Name = cnt.Account.Name + 'Changed';
                cnt.Account.Phone = '1111111111';
                update cnt.Account;


                This way of processing saves additional SQOL queries and code.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 7 hours ago

























                answered 7 hours ago









                salesforce-sassalesforce-sas

                3,1951 silver badge19 bronze badges




                3,1951 silver badge19 bronze badges






























                    draft saved

                    draft discarded
















































                    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%2f272390%2fare-the-related-objects-in-an-soql-query-shared%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

                    Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                    Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                    Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її