How to tell the object type of an AttachmentAPI Access to Google Doc Attachments?Triggering code on sObject Child Relationship actionsNeed to export attachments from Salesforce using a soql query and reload them to a different custom objectHow to “deep clone including Attachments” without hitting the heap space governor limit?Email File Attachment typeDecode Body from Attachment ObjectHow to Purge Case Attachments?How to remove notes and attachment from account object?Need help understanding this apex trigger exampleIssue in fetching the Task subject data from it's Attachment list via query

If an arcane trickster rogue uses his mage hand and makes it invisible, does that mean anything the hand picks up is also invisible?

What's the differences between the two version of oracle client download file, "client" and "client home"?

Exploiting the delay when a festival ticket is scanned

Why did some Apollo missions carry a grenade launcher?

What did G-d do before Creation?

Compound Word Neologism

Going from a circuit to the quantum state output of the circuit

Why force the nose of 737 Max down in the first place?

Telling manager project isn't worth the effort?

Does dual boot harm a laptop battery or reduce its life?

What language is Raven using for her attack in the new 52?

Why is it considered acid rain with pH <5.6?

Struggling with cyclical dependancies in unit tests

Spacing after a tikz figure

Introducing Tetronogram!

Desktop app status bar: Notification vs error message

Why didn’t Christianity spread southwards from Ethiopia in the Middle Ages?

How likely is fragmentation on a table with 40000 products likely to affect performance

Do 3/8 (37.5%) of Quadratics Have No x-Intercepts?

Anti-cheating: should there be a limit to a number of toilet breaks per game per player?

What happens when a flying sword is killed?

Japanese reading of an integer

Irreducible factors of primitive permutation group representation

Must a song using the A minor scale begin or end with an Am chord? If not, how can I tell what the scale is?



How to tell the object type of an Attachment


API Access to Google Doc Attachments?Triggering code on sObject Child Relationship actionsNeed to export attachments from Salesforce using a soql query and reload them to a different custom objectHow to “deep clone including Attachments” without hitting the heap space governor limit?Email File Attachment typeDecode Body from Attachment ObjectHow to Purge Case Attachments?How to remove notes and attachment from account object?Need help understanding this apex trigger exampleIssue in fetching the Task subject data from it's Attachment list via query






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








1















I need to export all of the attachments of an org. I would like to break them down to be in a folder based upon the object type of their parent. In other words, I want all attachments which are in an Account to be in one single folder, and all of the ones in an Opportunity to be in another folder.



I've been trying to determine how the Attachments are arranged by running queries on the Attachment object in Workbench. But I believe the closest I can come to determining this information is the Attachment object's ParentID field. But that's just the ID of the individual record, not the object type of the Parent. Is there any way to determine the object type of the Parent of the Attachment ?










share|improve this question






























    1















    I need to export all of the attachments of an org. I would like to break them down to be in a folder based upon the object type of their parent. In other words, I want all attachments which are in an Account to be in one single folder, and all of the ones in an Opportunity to be in another folder.



    I've been trying to determine how the Attachments are arranged by running queries on the Attachment object in Workbench. But I believe the closest I can come to determining this information is the Attachment object's ParentID field. But that's just the ID of the individual record, not the object type of the Parent. Is there any way to determine the object type of the Parent of the Attachment ?










    share|improve this question


























      1












      1








      1








      I need to export all of the attachments of an org. I would like to break them down to be in a folder based upon the object type of their parent. In other words, I want all attachments which are in an Account to be in one single folder, and all of the ones in an Opportunity to be in another folder.



      I've been trying to determine how the Attachments are arranged by running queries on the Attachment object in Workbench. But I believe the closest I can come to determining this information is the Attachment object's ParentID field. But that's just the ID of the individual record, not the object type of the Parent. Is there any way to determine the object type of the Parent of the Attachment ?










      share|improve this question














      I need to export all of the attachments of an org. I would like to break them down to be in a folder based upon the object type of their parent. In other words, I want all attachments which are in an Account to be in one single folder, and all of the ones in an Opportunity to be in another folder.



      I've been trying to determine how the Attachments are arranged by running queries on the Attachment object in Workbench. But I believe the closest I can come to determining this information is the Attachment object's ParentID field. But that's just the ID of the individual record, not the object type of the Parent. Is there any way to determine the object type of the Parent of the Attachment ?







      attachment






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jul 18 at 14:55









      Zoom_vZoom_v

      1,8503 gold badges33 silver badges70 bronze badges




      1,8503 gold badges33 silver badges70 bronze badges























          3 Answers
          3






          active

          oldest

          votes


















          2














          In a query, you can pull Parent.Type in your SELECT clause, or even filter on it in your WHERE clause.



          SELECT Body, Parent.Type FROM Attachment





          share|improve this answer
































            2














            Quite easy, just call getsobjecttype() on that Id, and it will return API name of that object.



            Id parentId= '00161000000Mjya'; 
            System.debug('object is '+ parentId.getsobjecttype()); //Returns Account


            Src: https://help.salesforce.com/articleView?id=000340200&language=en_US&type=1&mode=1






            share|improve this answer

























            • Thank you very much Pranay. I'm not quite sure how to incorporate that into my query, or my actual export. I'm going to use dataloader.io for the export, and it doesn't really have a way to filter based on that - or at least not from what I see. Any thoughts ?

              – Zoom_v
              Jul 18 at 15:24


















            1














            Just to add on the answer about getsobjecttype() :



            You can also check this video which explains how to export attachments from salesforce using NodeJS.



            You can adapt the code by adding query filter on object type and organise the file export in appropriate folder.



            Hope this helps






            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%2f270000%2fhow-to-tell-the-object-type-of-an-attachment%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              In a query, you can pull Parent.Type in your SELECT clause, or even filter on it in your WHERE clause.



              SELECT Body, Parent.Type FROM Attachment





              share|improve this answer





























                2














                In a query, you can pull Parent.Type in your SELECT clause, or even filter on it in your WHERE clause.



                SELECT Body, Parent.Type FROM Attachment





                share|improve this answer



























                  2












                  2








                  2







                  In a query, you can pull Parent.Type in your SELECT clause, or even filter on it in your WHERE clause.



                  SELECT Body, Parent.Type FROM Attachment





                  share|improve this answer













                  In a query, you can pull Parent.Type in your SELECT clause, or even filter on it in your WHERE clause.



                  SELECT Body, Parent.Type FROM Attachment






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 18 at 17:19









                  Adrian LarsonAdrian Larson

                  115k19 gold badges133 silver badges272 bronze badges




                  115k19 gold badges133 silver badges272 bronze badges


























                      2














                      Quite easy, just call getsobjecttype() on that Id, and it will return API name of that object.



                      Id parentId= '00161000000Mjya'; 
                      System.debug('object is '+ parentId.getsobjecttype()); //Returns Account


                      Src: https://help.salesforce.com/articleView?id=000340200&language=en_US&type=1&mode=1






                      share|improve this answer

























                      • Thank you very much Pranay. I'm not quite sure how to incorporate that into my query, or my actual export. I'm going to use dataloader.io for the export, and it doesn't really have a way to filter based on that - or at least not from what I see. Any thoughts ?

                        – Zoom_v
                        Jul 18 at 15:24















                      2














                      Quite easy, just call getsobjecttype() on that Id, and it will return API name of that object.



                      Id parentId= '00161000000Mjya'; 
                      System.debug('object is '+ parentId.getsobjecttype()); //Returns Account


                      Src: https://help.salesforce.com/articleView?id=000340200&language=en_US&type=1&mode=1






                      share|improve this answer

























                      • Thank you very much Pranay. I'm not quite sure how to incorporate that into my query, or my actual export. I'm going to use dataloader.io for the export, and it doesn't really have a way to filter based on that - or at least not from what I see. Any thoughts ?

                        – Zoom_v
                        Jul 18 at 15:24













                      2












                      2








                      2







                      Quite easy, just call getsobjecttype() on that Id, and it will return API name of that object.



                      Id parentId= '00161000000Mjya'; 
                      System.debug('object is '+ parentId.getsobjecttype()); //Returns Account


                      Src: https://help.salesforce.com/articleView?id=000340200&language=en_US&type=1&mode=1






                      share|improve this answer













                      Quite easy, just call getsobjecttype() on that Id, and it will return API name of that object.



                      Id parentId= '00161000000Mjya'; 
                      System.debug('object is '+ parentId.getsobjecttype()); //Returns Account


                      Src: https://help.salesforce.com/articleView?id=000340200&language=en_US&type=1&mode=1







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jul 18 at 15:01









                      Pranay JaiswalPranay Jaiswal

                      22.8k5 gold badges33 silver badges74 bronze badges




                      22.8k5 gold badges33 silver badges74 bronze badges















                      • Thank you very much Pranay. I'm not quite sure how to incorporate that into my query, or my actual export. I'm going to use dataloader.io for the export, and it doesn't really have a way to filter based on that - or at least not from what I see. Any thoughts ?

                        – Zoom_v
                        Jul 18 at 15:24

















                      • Thank you very much Pranay. I'm not quite sure how to incorporate that into my query, or my actual export. I'm going to use dataloader.io for the export, and it doesn't really have a way to filter based on that - or at least not from what I see. Any thoughts ?

                        – Zoom_v
                        Jul 18 at 15:24
















                      Thank you very much Pranay. I'm not quite sure how to incorporate that into my query, or my actual export. I'm going to use dataloader.io for the export, and it doesn't really have a way to filter based on that - or at least not from what I see. Any thoughts ?

                      – Zoom_v
                      Jul 18 at 15:24





                      Thank you very much Pranay. I'm not quite sure how to incorporate that into my query, or my actual export. I'm going to use dataloader.io for the export, and it doesn't really have a way to filter based on that - or at least not from what I see. Any thoughts ?

                      – Zoom_v
                      Jul 18 at 15:24











                      1














                      Just to add on the answer about getsobjecttype() :



                      You can also check this video which explains how to export attachments from salesforce using NodeJS.



                      You can adapt the code by adding query filter on object type and organise the file export in appropriate folder.



                      Hope this helps






                      share|improve this answer





























                        1














                        Just to add on the answer about getsobjecttype() :



                        You can also check this video which explains how to export attachments from salesforce using NodeJS.



                        You can adapt the code by adding query filter on object type and organise the file export in appropriate folder.



                        Hope this helps






                        share|improve this answer



























                          1












                          1








                          1







                          Just to add on the answer about getsobjecttype() :



                          You can also check this video which explains how to export attachments from salesforce using NodeJS.



                          You can adapt the code by adding query filter on object type and organise the file export in appropriate folder.



                          Hope this helps






                          share|improve this answer













                          Just to add on the answer about getsobjecttype() :



                          You can also check this video which explains how to export attachments from salesforce using NodeJS.



                          You can adapt the code by adding query filter on object type and organise the file export in appropriate folder.



                          Hope this helps







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jul 18 at 17:14









                          ShaminaShamina

                          1411 silver badge7 bronze badges




                          1411 silver badge7 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%2f270000%2fhow-to-tell-the-object-type-of-an-attachment%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

                              Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                              Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                              Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form