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

How can one convert an expression to a string while keeping the quotation marks of strings that are part of the expression?

How would you say "Sorry, that was a mistake on my part"?

How can I help our ranger feel special about her beast companion?

What were the problems on the Apollo 11 lunar module?

Term “console” in game consoles

Random piece of plastic

Why did Fury respond that way?

How to not confuse readers with simultaneous events?

Who determines when road center lines are solid or dashed?

Operation Unzalgo

Necroskitter and creatures dying because of placing -1/-1 counters

I have found a mistake on someone's code published online: what is the protocol?

Is it rude to refer to janitors as 'floor people'?

I want to identify a part from a photo

Parallel Computation with the possibility of calculation failure

When can a polynomial be written as a polynomial function of another polynomial?

Desecrating Shabbos to ask a Gadol to daven for a patient?

Locked-up DOS computer beeped on keypress. What mechanism caused that?

Why aren't there any women super GMs?

Strategy to pay off revolving debt while building reserve savings fund?

Should I use a resistor between the gate driver and MOSFET (gate pin)?

Is straight-up writing someone's opinions telling?

How to belay quickly ascending top-rope climbers?

How would thermophilic fish survive?



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









      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


















          1














          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
              7 hours ago


















            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









              1














              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



























                1














                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

























                  1












                  1








                  1







                  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 5 hours ago









                  Adrian LarsonAdrian Larson

                  114k19 gold badges131 silver badges270 bronze badges




                  114k19 gold badges131 silver badges270 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
                        7 hours ago















                      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
                        7 hours ago













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









                      Pranay JaiswalPranay Jaiswal

                      22.3k5 gold badges33 silver badges72 bronze badges




                      22.3k5 gold badges33 silver badges72 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
                        7 hours ago

















                      • 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
                        7 hours ago
















                      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
                      7 hours ago





                      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
                      7 hours ago











                      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 5 hours ago









                          ShaminaShamina

                          766 bronze badges




                          766 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

                              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

                              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

                              François Viète Contents Biography Work and thought Bibliography See also Notes Further reading External links Navigation menup. 21Google Bookspp. 75–77Google BooksDe thou (from University of Saint Andrews)ArchivedGoogle BooksGoogle BooksGoogle BooksGoogle booksGoogle Bookscc-parthenay.frL'histoire universelle (fr)Universal History (en)ArchivedAdsabs.harvard.eduPagesperso-orange.frArchive.orgChikara Sasaki. Descartes' mathematical thought p.259Google BooksGoogle BooksGoogle Bookspp. 152 and onwardGoogle BooksGoogle BooksScribd.comGoogle Books1257-7979Google BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGallica.bnf.frGoogle BooksGoogle Books"François Viète"Francois Viète: Father of Modern Algebraic NotationThe Lawyer and the GamblerAbout TarporleySite de Jean-Paul GuichardL'algèbre nouvelle"About the Harmonicon"cb120511976(data)1188044800000 0001 0913 5903n82164680ola2013766880073431702w6vt1sb70287374827140948071409480