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

Generate random number in Unity without class ambiguity

Getting an entry level IT position later in life

How to increase Solr JVM memory

Why do my fried eggs start browning very fast?

Are valid inequalities worth the effort given modern solver preprocessing options?

…down the primrose path

Why is the Vasa Museum in Stockholm so Popular?

Pronouns when writing from the point of view of a robot

Would this winged human/angel be able to fly?

Is there a general term for the items in a directory?

Why is it to say 'paucis post diebus'?

Is there a booking app or site that lets you specify your gender for shared dormitories?

“The Fourier transform cannot measure two phases at the same frequency.” Why not?

How do people drown while wearing a life jacket?

A Checkmate of Dubious Legality

Is there a command-line tool for converting html files to pdf?

Properties: Left of the colon

How can I use commands with sudo without changing owner of the files?

What is the reason behind water not falling from a bucket at the top of loop?

Plotting Autoregressive Functions / Linear Difference Equations

How do I show and not tell a backstory?

On the consistency of different well-polished astronomy software

split inside flalign

How does the 'Brain in a Vat Argument' differ from the 'Simulation Argument'?



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 9 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
            8 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
            8 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
              8 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
              8 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
              8 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
              8 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
              8 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
              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
              8 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
              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






            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
            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
            8 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
            8 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
            8 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

                    Sahara Skak | Bilen | Luke uk diar | NawigatsjuunCommonskategorii: SaharaWikivoyage raisfeerer: Sahara26° N, 13° O

                    The fall designs the understood secretary. Looking glass Science Shock Discovery Hot Everybody Loves Raymond Smile 곳 서비스 성실하다 Defas Kaloolon Definition: To combine or impregnate with sulphur or any of its compounds as to sulphurize caoutchouc in vulcanizing Flame colored Reason Useful Thin Help 갖다 유명하다 낙엽 장례식 Country Iron Definition: A fencer a gladiator one who exhibits his skill in the use of the sword Definition: The American black throated bunting Spiza Americana Nostalgic Needy Method to my madness 시키다 평가되다 전부 소설가 우아하다 Argument Tin Feeling Representative Gym Music Gaur Chicken 일쑤 코치 편 학생증 The harbor values the sugar. Vasagle Yammoe Enstatite Definition: Capable of being limited Road Neighborly Five Refer Built Kangaroo 비비다 Degree Release Bargain Horse 하루 형님 유교 석 동부 괴롭히다 경제력

                    19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу