Monday, October 30, 2017

Lightning Tree : Generic Lightning Component to Display Hierarchy for any sObject

In API version 41.0, Salesforce has introduce new component called lightning:tree. This can be used to display hierarchy in tree structure. Before this, we have to used jquery or other javascript libraries to implement this.

After introduction of lightning:tree, it is very easy to use this and implement this in short time.

I have created a generic lightning component to display records hierarchy in tree structure. You just have specify below attributes to component to display tree structure:

  • ltngcurrentRecId : Salesforce 15 or 18 digit Id of any record for which you want to see hierarchy.
  • ltngSobjectname : sObject API name (like Account, Case, Position__c etc.)
  • ltngParentFieldAPIName : Field API name which creates self relationship between records.
  • ltngLabelFieldAPIName : Field API name which will be used to display records in tree structure(like Name, CaseNumber, Title__c etc.).
  • ltngHierarchyHeader : Header label which will be displayed above tree structure.


Below is complete complete code for your reference:


You can use this code as reference and can implement different logic.

Hope this will help!!!

Looking forward for everyone's comments and suggestions.

109 comments:

  1. Is there any way to return additional fields for the tree as well? Perhaps even just a name + text field?

    ReplyDelete
  2. Hi,

    Create formula field and concatenate all the fields values as per required format and then refer that formula field in "ltngLabelFieldAPIName" attribute.
    ltngLabelFieldAPIName="UniqueValue__c"


    Hope this helps!!

    Thanks

    ReplyDelete
  3. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
    microsoft azure training in bangalore
    rpa training in velachery| rpa training in tambaram |rpa training in sholinganallur | rpa training in annanagar| rpa training in kalyannagar

    ReplyDelete
  4. Thanks Admin for sharing such a useful post, I hope it’s useful to many individuals for developing their skill to get good career.
    python Course in Pune
    python Course institute in Chennai
    python Training institute in Bangalore

    ReplyDelete
  5. Thanks For Sharing The Information The Information shared Is Very Valuable Please Keep Updating Us Time Just Went On reading The Article Aws Online Course Python Online Course Data Online Course Hadoop Online Course

    ReplyDelete
  6. Hi, is it possible to create a similar dynamic lightning:treeGrid or modify the above code to use lightning:tree within aura:iteration to meet the requirement? Thanks!

    ReplyDelete
  7. Attend The Python training in bangalore From ExcelR. Practical Python training in bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Python training in bangalore.
    python training in bangalore

    ReplyDelete
  8. Attend The Best Python Training in Bangalore From ExcelR. Practical Python Training in Bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Best Python Training in Bangalore.

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. ExcelR offers data science training in hyderabad , the most comprehensive Data Science course in the market, covering the complete Data Science lifecycle concepts from Data Collection, Data Extraction, Data Cleansing, Data Exploration, Data Transformation, Feature Engineering, Data Integration, Data Mining, building Prediction models.

    ReplyDelete
  11. Awesome Blog, It helped me to get into the next level and had lot of information in it, I really appreciate. Thanks for sharing this information. Keep blogging!! machine learning course bangalore

    ReplyDelete
  12. Attend The Data Analytics Courses in Bangalore From ExcelR. Practical Data Analytics Courses in Bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Data Analytics Courses in Bangalore.
    ExcelR Data Analytics Courses in Bangalore

    ReplyDelete
  13. My spouse and I love your blog and find almost all of your post’s to be just what I’m looking for. Artificial Intelligence Course

    ReplyDelete
  14. Very interesting blog Thank you for sharing such a nice and interesting blog and really very helpful article.sap mm Training in Bangalore

    ReplyDelete
  15. Its really helpful for the users of this site. I am also searching about these type of sites now a days. So your site really helps me for searching the new and great stuff.sap basis Training in Bangalore

    ReplyDelete
  16. Very useful and information content has been shared out here, Thanks for sharing it.sap hr Training in Bangalore

    ReplyDelete
  17. These provided information was really so nice,thanks for giving that post and the more skills to develop after refer that post.sap bw Training in Bangalore

    ReplyDelete
  18. Your articles really impressed for me,because of all information so nice.sap ehs Training in Bangalore

    ReplyDelete
  19. Really it was an awesome article,very interesting to read.You have provided an nice article,Thanks for sharing.sap abap Training in Bangalore

    ReplyDelete
  20. I know that it takes a lot of effort and hard work to write such an informative content like this.sap fico Training in Bangalore

    ReplyDelete
  21. I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own Blog Engine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.
    ExcelR Data Analytics Course

    ReplyDelete
  22. This post is very simple to read and appreciate without leaving any details out. Great work!
    Please check ExcelR Data Science Courses

    ReplyDelete
  23. Actually I read it yesterday but I had some thoughts about it and today I wanted to read it again because it is very well written.
    data science courses

    ReplyDelete
  24. Awesome article! I want people to know just how good this information is in your article. It’s interesting, compelling content. Your views are much like my own concerning this subject. Residential Tree Removal

    ReplyDelete
  25. Thank you so much for sharing this excellent information. I am glad to discover your post.
    Hadoop Training in Hyderabad

    ReplyDelete
  26. This Was An Amazing ! I Haven't Seen This Type of Blog Ever ! Thankyou For Sharing, data science traning

    ReplyDelete

  27. The information you have posted is very useful. The sites you have referred was good. Thanks for sharing. ExcelR Data Science Course In Pune

    ReplyDelete
  28. wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries.
    Data Science Course

    ReplyDelete
  29. Just the way I have expected. Your website really is interesting. ExcelR Data Scientist Course In Pune

    ReplyDelete
  30. This was really one of my favorite website. ExcelR Machine Learning Course In Pune Please keep on posting.

    ReplyDelete
  31. Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. hashtag for instagram likes and followers app

    ReplyDelete
  32. I finally found great post here.I will get back here. I just added your blog to my bookmark sites. thanks.Quality posts is the crucial to invite the visitors to visit the web page, that's what this web page is providing.
    artificial intelligence course in bangalore

    ReplyDelete
  33. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.
    https://360digitmg.com/internet-of-things-iot-in-hyderabad

    ReplyDelete
  34. Amazing post found to be very impressive while going through this post. Thanks for sharing and keep posting such an informative content.

    360DigiTMG Cloud Computing Course

    ReplyDelete
  35. Data science involves the study of data, which includes different stages, such as extraction, analysis, visualization, management and storage of data for creating insights. data science course syllabus

    ReplyDelete
  36. I am looking for and I love to post a comment that "The content of your post is awesome" Great work!

    Simple Linear Regression

    Correlation vs Covariance

    bag of words

    time series analysis

    ReplyDelete
  37. The above post that you shared is informative. keep doing this kind of work and the method you used to presenting the examples are easy to understand. I would like to thank for this wonderful blog. the article inspires me to do more research about this topic.

    Aws Training in Chennai

    Aws Training in Velachery

    Aws Training in Tambaram

    Aws Training in Porur

    Aws Training in Omr

    Aws Training in Annanagar

    ReplyDelete
  38. Great survey. I'm sure you're getting a great response. ExcelR Business Analytics Courses

    ReplyDelete
  39. This is a great motivational article. In fact, I am happy with your good work. They publish very supportive data, really. Continue. Continue blogging. Hope you explore your next post
    data science training

    ReplyDelete
  40. Wood ground surface can be bought and introduced either production line completed or incomplete. Completed items are by and large the simpler approach since it will be finished and prepared to stroll on following establishment.Vietnam manufacturing

    ReplyDelete
  41. Fantastic blog! Thanks for sharing a very interesting post, I appreciate to blogger for an amazing post.

    Python Institutes in Pune
    Python Classes in Pune

    ReplyDelete
  42. When your website or blog goes live for the first time, it is exciting. That is until you realize no one but you and your.
    data scientist training in hyderabad

    ReplyDelete
  43. Your content is very unique and understandable useful for the readers keep update more article like this.
    best data science course online

    ReplyDelete
  44. This knowledge.Excellently written article, if only all bloggers offered the same level of content as you, the internet would be a much better place. Please keep it up.
    artificial intelligence course in aurangabad

    ReplyDelete
  45. This comment has been removed by the author.

    ReplyDelete
  46. There are also times when trees can pose a threat to your property, when the roots have all popped out and can trip your kids. Roots can also puncture the sewer and plumbing lines. Tree Cutting Lincoln

    ReplyDelete
  47. When starting the bonsai interest, there are a few things you should think about first. The expense of trees and supplies should be remembered. For thirty dollars or thereabouts, a decent starting plant can be bought.Tree Removal Elk Grove

    ReplyDelete
  48. This kind of actually also a good placed that we in reality actually appreciated looking into. It isn't automatically typical that we are the substitute for establish a certain factor. Tree Trimming Rancho Cucamonga

    ReplyDelete
  49. In the event that your trunk is rotting, you will see bugs and mushrooms developing all through the lower part of the tree. Emergency Tree Service Sacramento

    ReplyDelete
  50. The solitary conceivable benefit of working an enormous scope one is that it can oblige various customers all at once. marketing agency

    ReplyDelete
  51. This really is at the same time a terrific subject matter as i somewhat certainly wanted taking a look at. This may not quite frequently that we include possibility to lift weights a major issue. Tree Removal Encinitas

    ReplyDelete
  52. In the ninth century the name 'Pine' had yet to be coined, so today if you translate that saying, you get, 'The city of Venice rests on the hearts of Pine. How Fast Do Pine Trees Grow

    ReplyDelete
  53. When starting the bonsai leisure activity, there are a few things you should think about first. Stump Grinding Pearland

    ReplyDelete
  54. A salesforce stuff, good and quality content shared, keep sharing.

    Data Science Training in Pune

    ReplyDelete
  55. Before you start a tree removal service, there are a lot of things you should take into consideration. Emergency Tree Service Irvine

    ReplyDelete
  56. You may also check if the persons that the company will send at your place have the necessary training that proves that they are capable of doing the job. Tree Trimming Garden Grove

    ReplyDelete
  57. A few trees might debilitate the foundation of your home in view of developing roots underneath the land over the long run. Tree Trimming Rocklin

    ReplyDelete
  58. I recently came across your article and have been reading along. I want to express my admiration of your writing skill and ability to make readers read from the beginning to the end.
    Python Classes in Pune

    ReplyDelete
  59. A professional company will be able to handle big jobs by using the best tools and methods available. Safest Tree Removal Methods Tree Service Experts Elk Grove

    ReplyDelete
  60. If getting your tree removed is really needed, getting a professional tree service is important. Tree Cutting services Riverside, CA

    ReplyDelete
  61. But before deciding on which service contractor to get, one must identify the reason of the tree removal service. Some of the most common tree problems are dead trees and branches, fungus growths and leaning trees. modern tree service tools

    ReplyDelete
  62. I appreciate you sharing this blog article. Really thank you! Really Great.Stump Grinding Long Beach

    ReplyDelete
  63. Appreciate you sharing great blog. Thanks Again.
    modern tree service tools

    ReplyDelete
  64. Really enjoyed this blog post. Really thank you! Really Great.Tree Cutting professionals Louisville

    ReplyDelete
  65. Im thankful for the post. Really looking forward to read more. Want more.Safest Tree Removal Methods Tree Service Experts Nashville

    ReplyDelete
  66. This is also a very good post which I really enjoyed reading. It is not every day that I have the possibility to see something like this..
    artificial intelligence courses aurangabad

    ReplyDelete
  67. Your second cut should create a wedge into the tree. So make the second cut at an angle from the initial cut. It should look like a lemon wedge. Tree removal Sanford NC

    ReplyDelete
  68. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. Arbor Care Solutions

    ReplyDelete



  69. This blog contains more information,keep sharing your valuable thoughts.
    Appium Certification in Chennai
    Appium Training

    ReplyDelete
  70. I really liked your blog post. Much thanks again. Will read on...tree trimming

    ReplyDelete
  71. Web Development India offer website development services, php development services, laravel development services etc services offer by website development company in india

    ReplyDelete
  72. A tree surgeon (or arborist) helps to treat sick or indeed damaged trees. They also remove dead trees that could be problematic. The treatment of a sick tree could involve anything from removing parts, to removing fungus and bacteria with insecticides. They also help to remove branches which may pose a falling hazard. http://treethyme.co.uk

    ReplyDelete
  73. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. Great work
    data science training

    ReplyDelete
  74. You can likewise look on the web and find sites where you can profit specialist of tree administration. tree surgeon worcester

    ReplyDelete
  75. An organization like JL Tree Administration Inc has more than 18 top tree climbers with numerous long stretches of involvement with enormous expulsions and crane evacuations.
    tree services Columbia MO

    ReplyDelete
  76. The cost of tree cutting will be around $200 and $400. With more modest trees for example those growing 30 feet and beneath, the expulsion expenses are from $120. tree removal

    ReplyDelete
  77. Adding just two creeps of soil to the establishing region can be sufficient to kill a full grown tree.
    tree trimming

    ReplyDelete
  78. Python is a programming language that enables quicker work and more efficient system integration. Because of its simplicity, ease of use, and accessibility to libraries like NumPy, Pandas, and Matplotlib, it is one of the best languages used by data scientists for a variety of data science applications. You will gain a multidisciplinary skill set and be prepared to work with massive volumes of data to find insights and solutions to business challenges after completing this data science certification course. Having this certification will provide you a technical understanding of computer science and statistics in addition to a postgraduate degree. It covers the spring framework, hibernate, and advanced java.best data science institute in nashik with placement

    ReplyDelete
  79. Wow, this is a game-changer! Salesforce's lightning:tree in API 41.0 will simplify hierarchy display without the need for external libraries. Great progress! 🌟 #SalesforceUpdates

    Data Analytics Courses in Delhi
    Data Analytics Courses in Delhi

    ReplyDelete
  80. Hello Blogger,
    This Lightning Tree component is a game-changer, simplifying hierarchical data display in Salesforce. It's a well-documented, efficient solution that will greatly benefit users. Fantastic work.
    Data Analytics Courses In Dubai

    ReplyDelete
  81. You may need to tailor this approach to your specific use case and hierarchy data structure. Get more and more.
    Data Analytics Courses In Chennai

    ReplyDelete
  82. Your blog post not only introduces this powerful tool but also explains its implementation in a clear and concise manner.
    Data Analytics courses IN UK

    ReplyDelete
  83. A generic Lightning Component for displaying hierarchies is a versatile solution for Salesforce developers, allowing them to represent object relationships dynamically within the platform.
    For those looking to delve into the world of data analytics, Glasgow offers a range of Data Analytics courses that provide the expertise needed to navigate and leverage data effectively. Please also read Data Analytics courses in Glasgow .

    ReplyDelete
  84. "I'm impressed with the functionality and flexibility of your Lightning Tree component, enabling users to visualize hierarchical data for any sObject. Its intuitive design and seamless integration within the Salesforce platform make it an invaluable asset for users managing complex data relationships. Well done!"
    Digital marketing courses in woking


    ReplyDelete
  85. This comment has been removed by the author.

    ReplyDelete
  86. Thank you for sharing such blogs , really appreciate the content and language used
    Digital Marketing Courses In Spain

    ReplyDelete
  87. Thanks for sharing insightful and informative tutorial on Lightning Tree .
    data analyst courses in limerick

    ReplyDelete
  88. Thank you for sharing in depth knowledge and excellent explanation on Lightning Tree.
    Digital Marketing Courses In Bhutan

    ReplyDelete
  89. Your step-by-step guide, complete with code snippets and explanations, made it incredibly easy to follow along. I've always found visualizing geographic data a bit daunting, but your post has demystified the process for me. The use of the Mapping Toolbox in MATLAB seems like a powerful tool, and your examples really showcased its capabilities. Digital marketing for business

    ReplyDelete
  90. Thanks for helping in CODING issue. It is great help and great blog. Nice work keeps it up.
    Investment banking courses in the world

    ReplyDelete

  91. "Your blog on Lightning Tree, the generic Lightning Component for displaying hierarchy across any sObject, is a game-changer for Salesforce developers. The adaptability and versatility showcased in your implementation open new avenues for visualizing data structures. Thanks for sharing this ingenious solution, making hierarchy display in Lightning Components more accessible and dynamic across Salesforce platforms."
    Investment banking as a career in India

    ReplyDelete
  92. Thanks for sharing useful tips. It will indeed help users in resolving their problems.
    Investment banking courses after 12th

    ReplyDelete