How to tell the object type of an AttachmentAPI Access to Google Doc Attachments?Triggering code on sObject...

How would thermophilic fish survive?

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

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

Why won't some unicode characters print to my terminal?

Is it possible to have a career in SciComp without contributing to arms research?

Is Error correction and detection can be done with out adding extra bits?

Who determines when road center lines are solid or dashed?

Exporting animation to Unity

I want to identify a part from a photo

Which GPUs to get for Mathematical Optimization (if any)?

Which modern firearm should a time traveler bring to be easily reproducible for a historic civilization?

When designing an adventure, how can I ensure a continuous player experience in a setting that's likely to favor TPKs?

How to find location on Cambridge-Mildenhall railway that still has tracks/rails?

What did Jeremy Hunt mean by "slipped" to miss a vote?

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

Why a binary file is not shown as 0 and 1?

Not able to find the "TcmTemplateDebugHost" process in Attach process, Even we run the Template builder

Why are there few or no black super GMs?

What could make large expeditions ineffective for exploring territory full of dangers and valuable resources?

Did Hitler say this quote about homeschooling?

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

Is encryption still applied if you ignore the SSL certificate warning for self signed?

Zhora asks Deckard: "Are you for real?". Was this meant to be significant?

Everyone but three



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

                              Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

                              The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

                              Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...