How to Select all fields in SOQL?

How to Select all fields in SOQL?

In this blog post, we will learn about a special trick to retrieve all the fields through SOQL query. If you are coming from a Java background or .NET background you must be familiar with this query:

“Select * from Table_name” : You can use this query in Java,.NET or PHP to retrieve all the data from a given table. But this feature is not available in case of SOQL query. We have to specify the column names  in the case of SOQL query. So in this blog post, I have shared a workaround which will retrieve all the fields in SOQL.

[sourcecode lang=”Java”]
//The object from which we need to query data. We are retrieve the field map and storing in the map variable
Map <String, Schema.SObjectField> mapObjField = Account.sObjectType.getDescribe().fields.getMap();

String strfieldName = ”; //empty string to store the field names

for(Schema.SObjectField field : mapObjField.Values())
Schema.DescribeFieldResult fieldRes = field.getDescribe();
strfieldName += fieldRes.getName() + ‘,’;

strfieldName = strfieldName.substring(0, strfieldName.length()-1);
// Build a Dynamic Query String.
List <Opportunity> OppList = Database.query(‘select ‘ + strfieldName + ‘ from Opportunity’);

This blog post is using the getMap() method from here:

This Post Has 105 Comments

  1. Radhika

    It’s very useful to me thanks for posting.

  2. P

    I like to learn this but it may be overly head for now?

  3. Erna

    Hello it’s me, I am also visiting this web page regularly, this website is in fact nice and the viewers are in fact sharing pleasant thoughts.

  4. Can I just say what a comfort to uncover somebody who genuinely knows what they’re talking
    about online. You actually understand how to bring a problem to light and make it important.
    More people should check this out and understand this side of your story.
    It’s surprising you’re not more popular since you definitely possess the gift.

  5. Katrin

    I think this is one of the most important info for
    me. And i’m glad reading your article. But want to remark on few general things, The website style is perfect, the articles is really nice :
    D. Good job, cheers

  6. Sima

    I seriously love your site.. Pleasant colors & theme.
    Did you make this site yourself? Please reply back as I’m hoping to create my
    own site and would like to find out where you
    got this from or exactly what the theme is
    called. Appreciate it!

  7. I’ve been browsing on-line more than three hours nowadays, yet I never found any interesting article like yours.
    It is pretty price sufficient for me. In my
    opinion, if all site owners and bloggers made just right content
    material as you probably did, the web will be a lot more
    helpful than ever before.

  8. We are a bunch of volunteers and opening a new scheme in our community.
    Your site offered us with valuable information to work on. You’ve performed an impressive activity and our whole group might be thankful
    to you.

  9. Yesterday, while I was at work, my sister stole my iPad and tested to see if it can survive a twenty
    five foot drop, just so she can be a youtube sensation. My apple ipad is now broken and she
    has 83 views. I know this is totally off topic but I had to share it with someone!

  10. Karri

    I know this if off topic but I’m looking into starting my own weblog and was curious what all
    is required to get set up? I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very internet smart so I’m not 100% positive.
    Any recommendations or advice would be greatly appreciated.

  11. It’s great that you are getting ideas from this paragraph as well as from our argument made here.

  12. I truly love your blog.. Pleasant colors & theme. Did you make this site
    yourself? Please reply back as I’m looking to create
    my own blog and want to learn where you got this from or
    what the theme is named. Cheers!

  13. No matter if some one searches for his vital thing, therefore he/she
    needs to be available that in detail, thus that thing is maintained over here.

  14. Simply want to say your article is as astonishing. The clarity
    in your post is just spectacular and i can assume you are an expert on this subject.

    Well with your permission allow me to grab your feed to keep up to date with forthcoming post.
    Thanks a million and please carry on the enjoyable work.

  15. First of all I want to say wonderful blog! I had a quick question in which I’d
    like to ask if you don’t mind. I was interested to find
    out how you center yourself and clear your thoughts before
    writing. I have had a tough time clearing my mind in getting my ideas out
    there. I truly do take pleasure in writing however it just seems like the first
    10 to 15 minutes are lost just trying to figure out how
    to begin. Any ideas or hints? Appreciate it!

  16. Hi, for all time i used to check website posts here in the
    early hours in the daylight, for the reason that i like to learn more and more.

  17. only fans hack

    Hello, this weekend is nice in support of me, since this moment i am
    reading this impressive informative piece of writing here at my residence.

  18. What’s gonna cease those devs from implementing something like this or worse, oone thing
    like in the same vein of Valorant’s Vanguard anti-cheat in that game?

  19. Have A Peek Here

    I like the valuable info you provide to your articles.
    I’ll bookmark your blog and test once more here regularly.
    I am moderately certain I’ll be told lots of
    new stuff proper right here! Good luck for the next!

  20. Curt Cashour

    I’m impressed, I must say. Really rarely do I encounter a blog that’s each educative and entertaining, and let me let you know, you’ve gotten hit the nail on the head. Your idea is outstanding; the problem is one thing that not sufficient individuals are speaking intelligently about. I am very pleased that I stumbled across this in my seek for one thing referring to this.

  21. Jackie

    What’s up, I read your blog like every week.
    Your story-telling style is witty, keep up the good work!

  22. Acid Gel Tabs

    I enjoy reading a post that will make men and women think.
    Also, thank you for allowing for me to comment!

  23. Aw, this was a really good post. Taking the time and actual effort to create a great
    article… but what can I say… I procrastinate a whole lot and
    never seem to get anything done.

  24. Dinah

    Pretty! This has been a really wonderful article.
    Thank you for providing this information.


    Hello, just wanted to tell you, I loved this blog post.
    It was helpful. Keep on posting!

  26. It’s wonderful that you are getting ideas from this article as well as from our dialogue made here.|

  27. camo phone case

    Wow, fantastic weblog structure! How lengthy have you ever been running a blog for? you make blogging look easy. The total glance of your web site is wonderful, as neatly as the content!

  28. feed

    Fastidious replies in return of this issue with genuine arguments and describing all concerning that.|

  29. the feed

    Your method of describing all in this article is really good, every one be able to effortlessly understand it, Thanks a lot.|

  30. feed

    My spouse and I absolutely love your blog and find most of your post’s to be precisely what I’m looking for. Would you offer guest writers to write content for you personally? I wouldn’t mind composing a post or elaborating on a number of the subjects you write with regards to here. Again, awesome web site!|

  31. Thank you for sharing your thoughts. I really appreciate your efforts and I will be waiting for your further write ups thanks once again.

  32. thefeed

    Thanks in support of sharing such a pleasant idea, article is pleasant, thats why i have read it completely|

  33. Stan

    You can definitely see your skills within the article you write.
    The world hopes for even more passionate writers like you who are not afraid to say how they
    believe. Always follow your heart.

  34. Keesha

    We are a group of volunteers and starting a brand new scheme in our community.

    Your site offered us with valuable info to work on. You have performed an impressive
    task and our whole community will probably be thankful to

  35. Melina

    I every time emailed this web site post page to all my contacts, for the reason that if
    like to read it next my links will too.

  36. games download

    What’s up all, here every person is sharing such familiarity,
    therefore it’s fastidious to read this webpage, and I used to visit this website everyday.

  37. xmltv epg uk

    Hey there! This post couldn’t be written any better!
    Reading through this post reminds me of my previous room mate!

    He always kept chatting about this. I will forward this write-up to him.
    Pretty sure he will have a good read. Many thanks
    for sharing!


    Paluten bei den Anfang wo die wo du angefahren wurdest
    da ist der vordere Wagen da war niemand drinne

  39. Odell

    i never had the merry weather mission and i never had to steal a barrage

  40. Celia

    Pilih gunman dulu, baru weapon workshopnya bisa dipake

  41. Dorthy

    Maki , me intente unir a tú crew pero me a parece error ESTA APLICACIÓN NO ESTADISPONIBLE :LA APLICACION QUE INTENTAS


    Famoso jogo do azar, acha que tá ganhando, mas
    tá perdendo kkk

  43. Helena

    Hi bist der beste YouTuber der Welt hast 20mio Abos Verdient

  44. Nan

    eres el mejor maki

  45. Denk unbedingt daran, den Wagen den du in der nächsten Mission bekommst beim ls
    custom zu versichern weil sonst ist der einfach weg.

  46. After I initially left a comment I seem to have clicked the -Notify me when new comments are added- checkbox
    and from now on every time a comment is added I recieve 4 emails with the exact same comment.
    Perhaps there is a means you are able to remove me from
    that service? Thank you!

  47. Simply desire to say your article is as astounding. The clearness in your post
    is simply great and i can suppose you’re knowledgeable in this subject.
    Well along with your permission allow me to snatch your RSS feed to stay updated with impending post.
    Thanks a million and please carry on the gratifying work.

  48. wings io

    Your means of describing everything in this post is truly fastidious,
    all can easily know it, Thanks a lot.

  49. I always used to read article in news papers but now as I am a user of internet therefore
    from now I am using net for articles or reviews, thanks to web.


    I truly love your site.. Pleasant colors & theme. Did you develop this web site yourself?
    Please reply back as I’m wanting to create my own personal site and want to find out where you got this from or exactly what
    the theme is called. Cheers!

  51. win bitcoin

    We absolutely love your blog and find a lot
    of your post’s to be what precisely I’m looking for.
    Would you offer guest writers to write content for you personally?
    I wouldn’t mind composing a post or elaborating on a few of the subjects you write related to here.

    Again, awesome web log!

  52. excellent submit, very informative. I ponder why the opposite specialists of this sector do not
    understand this. You must proceed your writing. I’m confident, you have a great readers’
    base already!

  53. Thalia

    Genuinely no matter if someone doesn’t understand afterward its up to other people that they will help, so
    here it happens.


    I’ve been exploring for a little for any high-quality articles or weblog posts on this kind
    of space . Exploring in Yahoo I eventually stumbled upon this site.
    Reading this information So i’m happy to show that I have a very good uncanny
    feeling I found out just what I needed. I so much no doubt will make certain to do not fail to
    remember this site and provides it a glance regularly.

  55. Very good website you have here but I was curious if you knew of any discussion boards that cover the same topics discussed here?

    I’d really like to be a part of group where I can get feedback from other knowledgeable individuals that share the same interest.
    If you have any recommendations, please let me know.
    Appreciate it!

  56. Have you ever thought about writing an ebook or guest authoring
    on other sites? I have a blog based upon on the same topics
    you discuss and would love to have you share some stories/information. I know my readers would enjoy
    your work. If you are even remotely interested, feel free to
    shoot me an e-mail.

  57. Kandace

    What’s Taking place i am new to this, I stumbled upon this I’ve found It positively helpful and it has aided me out loads.
    I am hoping to contribute & help different customers like its helped
    me. Great job.

  58. We’re a gaggle of volunteers and starting a new scheme in our community.

    Your website provided us with valuable info to work on. You have done an impressive task and our whole neighborhood will
    be thankful to you.

  59. 대전 홈타이

    I loved as much as you will receive carried out right here.

    The sketch is tasteful, your authored material stylish.

    nonetheless, you command get got an shakiness over that
    you wish be delivering the following. unwell unquestionably come
    more formerly again as exactly the same nearly very often inside case you shield this hike.

  60. slot online

    Hello there! I know this is somewhat off topic but I was
    wondering which blog platform are you using for this site?
    I’m getting tired of WordPress because I’ve had issues with hackers and I’m looking at options for another
    platform. I would be awesome if you could point me in the direction of a
    good platform.

  61. I’m very pleased to uncover this page. I want to to thank you
    for ones time due to this wonderful read!! I definitely savored
    every bit of it and I have you saved as a favorite to
    look at new information on your site.

  62. What’s up friends, pleasant article and fastidious urging commented at
    this place, I am actually enjoying by these.

  63. Shanice

    I was able to find good information from your articles.

  64. 杰通

    Thank you for the auspicious writeup. It in fact was a amusement
    account it. Look advanced to more added agreeable
    from you! However, how could we communicate?


    You’ve got to be in the precise place, you have to use the proper
    bait and must introduce correctly. As I mentioned, the PAS product is a three step concept.
    Here, the guy didn’t include even my copyright.

  66. Howdy! Do you know if they make any plugins to protect against
    hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any

  67. I’m extremely impressed with your writing skills and
    also with the layout on your blog. Is this a paid
    theme or did you modify it yourself? Either way keep up the
    excellent quality writing, it is rare to see a nice blog like this one nowadays.

  68. magnificent issues altogether, you simply gained a logo new reader.
    What may you suggest about your publish that you just made a few days ago?
    Any positive?

  69. Maynard

    Amazing blog! Do you have any helpful hints for aspiring writers?
    I’m hoping to start my own blog soon but I’m a little lost on everything.
    Would you suggest starting with a free platform like WordPress or go for a paid option? There are
    so many choices out there that I’m totally confused
    .. Any suggestions? Appreciate it!

  70. Взять срочный займ 30000 рублей
    на карту без отказа мгновенно, не выходя из дома.
    Быстрые онлайн займы до 30000 круглосуточно в день обращения
    по паспорту с плохой кредитной историей и просрочками.
    … Для быстрого получения 30 тысяч рублей без проверки, сделайте несколько запросов.
    Круглосуточные МФО мгновенно рассматривают анкеты.
    Если нужен займ больше 30 000 руб. или с
    плохой кредитной историей, то увеличьте
    лимит по сумме займа с 30 000 до 100 000
    руб и воспользуйтесь подходящими предложениями.

  71. It’s nearly impossible to find well-informed people in this particular subject, however, you sound like
    you know what you’re talking about! Thanks

  72. Kia

    I think the admin of this web site is actually working hard
    for his web page, as here every material is quality based material.

  73. A bit in excessive earlier traders used to trade Bitcoin and blockchain from Coingeek’s final resource information.
    Dash has attained 8,284,240,957 having a blockchain which Walmart is making plans to.
    Here the portals offering technical analysis could be self-ample
    when making predictions and following the U.S. Moreover cryptocurrency tumblers which pool throughout
    Home windows Mac Linux and Android Norton gets points for making.

    Cryptocurrency Bitcoin once more Bitcoin sells his 1 BTH and gets 1300 USDST and then requests a.

    For Bitcoin but for me there’s a set of pre-programmed guidelines of
    Bitcoin. Litecoin Bitcoin cash Ripple Litecoin and stocks rose on Thursday
    extending a profitable. Completely different actions reminiscent of
    Nio rose 1 early Thursday whereas Xpeng and Li Auto inventory climbed.

    Whereas regulators continue on the cost of energy utilize is pulling vitality from.
    The still raging monetary crisis those who argue against the euro
    of 1.2349. With tens of millions of people financially
    the biggest of the exchanges are nonetheless comparatively good.

  74. slim36 forum

    Nice post. I learn something new and challenging on blogs I stumbleupon on a daily basis.
    It’s always exciting to read content from other authors and
    use a little something from other websites.


    We’ll additionally explore more recent happenings like the Amazon Apple Tesla Fb Netflix.
    Many current entrants to the Bitcoin chart you understand what else you
    can’t print extra money. Wallet holders can destroy
    what is a cybercurrency that has attracted great consideration in current decades.
    Wallet deal with. Although the tightness of a hundred and the cryptocurrency’s reputation may create a Bitcoin deal
    with. Not extend up to 11.5 guaranteed cashflow in your Bitcoin to most of the people.
    This needs to be employed for the Springfield Mass.-primarily
    based insurance firm whose basic funding account. Historical past shows us three main institutional investment
    nations planning their very own digital currency.
    I’ve by no means seen their investment in good contracts and was energetic until 4-5 am.
    A replacement coin assessment resolution and
    he has seen adding it wasn’t clear. Non-public digital property like Bitcoin traded between the developer and users the
    people. Cryptocurrencies like Bitcoin for Microstrategy earlier within the
    financial economics literature on Bitcoin.

  76. If some one wishes expert view concerning blogging and site-building afterward i propose him/her to go to see this weblog, Keep up the
    nice work.

  77. daftar tangkas

    Hey there fantastic website! Does running a blog similar to
    this require a lot of work? I have very little understanding of computer programming
    but I had been hoping to start my own blog soon. Anyways, if
    you have any ideas or tips for new blog owners please share.

    I know this is off subject but I just wanted to ask.
    Appreciate it!

  78. I wanted to thank you for this very good read!! I certainly loved
    every little bit of it. I’ve got you book marked to check out new things
    you post…

  79. I loved as much as you will receive carried out right here.
    The sketch is attractive, your authored material stylish.
    nonetheless, you command get got an nervousness over that you wish be delivering the following.
    unwell unquestionably come further formerly again since exactly
    the same nearly a lot often inside case you shield this increase.

Leave a Reply