In this blog, I am going to create a lightning component which is a replica of the record type selector in lightning, its so simple, its a continuation of my last blog about lightning model link
So lets get started,
Here is the controller, which is fetching all the record type of the Account object
Now here is the lightning component code
Here is the component, if you have read the last blog about the lightning model, then it would be easy to understand this one
This is the Component code, here we have a modal and button, which will have functionality of opening the modal, and the other button will open the Account record creation modal which is standard.
Here is the controller code, which you can add to the controller which we have written earlier in the lightning modal blog, just add these two methods in the controller and we are done with the controller, init method is to initialise method of the helper and createRecord is a standard function which you can use in the lightning component to get the standard functionality of creation of the records.
Here is our helper, where we are calling the controllers method, which will return us a list of the all the record type of the Account object,
You are done, now lets see how it looks,
Here is the modal having list of record types of Account.
And here is the record detail to create a new Account record
To run the above component, create a lightning app
Here is the github Repo for updated code and deploying it salesforce Github
Post a comment if you have any query, I would be happy to help,
thank you !!
So lets get started,
Here is the controller, which is fetching all the record type of the Account object
public class RecordTypeSelectorController { @AuraEnabled public static List<RecordType> getListOfRecordType(){ String query = 'SELECT Id,Name FROM RecordType WHERE IsActive=TRUE AND SobjectType =\''+'Account'+'\' '; List<RecordType> rtNames = new List<RecordType>(); Schema.SObjectType objType = Account.SObjectType; for(RecordTypeInfo rt : objType.getDescribe().getRecordTypeInfos()){ rtNames.add(new RecordType(Id = rt.getRecordTypeId(),Name = rt.getName())); } return rtNames; } @AuraEnabled public static Id getAccountRecordType() { Id ClientRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Client').getRecordTypeId(); return ClientRecordTypeId; } }
Now here is the lightning component code
Here is the component, if you have read the last blog about the lightning model, then it would be easy to understand this one
This is the Component code, here we have a modal and button, which will have functionality of opening the modal, and the other button will open the Account record creation modal which is standard.
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" controller="RecordTypeSelectorController" access="global"> <ltng:require styles="/resource/SLDS103/assets/styles/salesforce-lightning-design-system-ltng.css" /> <aura:handler name="init" value="{!this}" action="{!c.doInit}" access="public"/> <aura:attribute name="recordTypes" type="String[]" access="public"/> <div class="slds"> <div > <!-- modal body starts here --> <div tabindex="-1" aria-labelledby="header43" aria-hidden="false" id="newClientSectionId" role="dialog" class="slds-modal slds-fade-in-open" style="display:none;"> <div class="slds-backdrop slds-backdrop--open"> <div class="slds-modal__container"> <div class="slds-modal__header"> <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close"> <button class="slds-button slds-button--neutral" onclick="{!c.hideModal}">X</button> <span class="slds-assistive-text">Close</span> </button> <h2 id="header43" class="slds-text-heading--medium">Modal Header</h2> </div> <div class="slds-modal__content slds-p-around--medium"> Select a record type : <br/> <div style="margin-left:30%"> <aura:iteration items="{!v.recordTypes}" var="rt"> <ol class="slds-list--vertical slds-list--vertical-space"> <input type="radio" value="{!rt.Name}" name="recordTypeRadio" id="{!rt.Id}" style="margin-right: 5px;" />{!rt.Name} </ol> </aura:iteration> </div> </div> <div class="slds-modal__footer"> <button class="slds-button slds-button--brand" onclick="{!c.hideModal}">Cancel</button> <button class="slds-button slds-button--brand" onclick="{!c.createRecord}">Next</button> </div> </div> </div> </div> <button class="slds-button slds-button--neutral" onclick="{!c.showModal}">Open Modal</button> </div> </div> </aura:component>
Here is the controller code, which you can add to the controller which we have written earlier in the lightning modal blog, just add these two methods in the controller and we are done with the controller, init method is to initialise method of the helper and createRecord is a standard function which you can use in the lightning component to get the standard functionality of creation of the records.
createRecord : function (component, event, helper) { var rtDet = document.querySelector('input[name="recordTypeRadio"]:checked'); if(rtDet != null) { document.getElementById("newClientSectionId").style.display = "none" ; var createRecordEvent = $A.get("e.force:createRecord"); createRecordEvent.setParams({ "entityApiName": "Account", "recordTypeId":rtDet.id }); createRecordEvent.fire(); } }, doInit : function(component, event, helper) { helper.RecordTypeSelectorController(component); }
Here is our helper, where we are calling the controllers method, which will return us a list of the all the record type of the Account object,
({ RecordTypeSelectorController: function(component) { var action = component.get("c.getListOfRecordType"); action.setCallback(this, function(actionResult) { var infos = actionResult.getReturnValue(); component.set("v.recordTypes", infos); }); $A.enqueueAction(action); } })
You are done, now lets see how it looks,
Here is the modal having list of record types of Account.
And here is the record detail to create a new Account record
To run the above component, create a lightning app
<aura:application >
<c:RecordTypeSelector />
</aura:application>
Here is the github Repo for updated code and deploying it salesforce Github
Post a comment if you have any query, I would be happy to help,
thank you !!
Hi Abhi, do you have any idea based on parent record type selection child record type should get selected and the record creation page should come. This should be achieved thru quick action lightning component.. any idea on this
ReplyDeleteThis comment has been removed by the author.
ReplyDeletebest explained. Salesforce Training in Chennai
ReplyDeleteThis comment has been removed by the author.
ReplyDeletebest Explained. coursquare
ReplyDeleteNice content.very useful thank you! for your creative ideas.
ReplyDeletecoursquare
education
Is there any way to prepopulate values on the record detail page? For instance: prepopulate Account Name.
ReplyDeleteDo you have sample one for these if they have descriptions below?
ReplyDeletehow to open visualforce page after record selection.I have scenario with once select the account record type then it should open my custom VF page .but it opens the std.page.I have already override New button in lighting as VF page.
ReplyDeleteVery nice blog, Thank you for providing good information.
ReplyDeleteAviation Academy in Chennai
Air hostess training in Chennai
Airport management courses in Chennai
Ground staff training in Chennai
aviation institute in Chennai
cabin crew training in Chennai
diploma in airport management course in Chennai
airport ground staff training courses in Chennai
Thanks for this article, your post helps me to understand the future and career prospects. Keep updating your blog with the latest information.
ReplyDeleteSalesforce Training in Chennai
Salesforce Training
Salesforce course in Chennai
AngularJS Training in Chennai
ccna course in Chennai
PHP Training in Chennai
gst Training in Chennai
Tally course in Chennai
Salesforce Training in Anna Nagar
Salesforce course
Great Article. Thank you for sharing! Really an awesome post for every one.
ReplyDeleteIEEE Final Year projects Project Centers in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation. For experts, it's an alternate ball game through and through. Smaller than expected IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble. Final Year Project Domains for IT It gives you tips and rules that is progressively critical to consider while choosing any final year project point.
JavaScript Training in Chennai
JavaScript Training in Chennai
best php training in chennai
ReplyDeletebest php developer institution chennai
best php training with placement in chennai
best php training center in chennai
best php course in chennai
Have a nice blog
ReplyDeleteThank for sharing Information
php online training in chennai
php programming center in chennai
php class in chennnai
php certification course
php developer training institution chennai
php training in chennnai
php mysql course in chennai
php institute in chennnai
php course in chennnai
php training with placement in chennnai
php developer course
Great work!
ReplyDeleteNIce Blog
appium online training
appium training centres in chennai
best appium training institute in chennnai
apppium course
mobile appium in chennnai
mobile training in chennnai
appium training institute in chennnai
You write this post very carefully I think, which is easily understand to me. Not only this, other post is also good. As a newbie this info is really helpful for me. Thanks to you.
ReplyDeletetally training
Tally Training in Chennai
Tally ERP 9 Training
Tally Course
tally classes
Tally institute in Chennai
Tally Training institute in Chennai
Tally course in Chennai
This content of information has
ReplyDeletehelped me a lot. It is very well explained and easy to understand.
SEO Training
seo course
Thanks for the interesting blog that you have implemented here. Very helpful and innovative. Waiting for your next upcoming article.
ReplyDeleteDigital Marketing Course In Kolkata
Great Article. Thank you for sharing! Really an awesome post for every one.
ReplyDeleteDigital Marketing Course In Kolkata
Web Design Course In Kolkata
Such an nice blog. Thanks for sharing this awesome information.
ReplyDeleteAngularJS training in chennai | AngularJS training in anna nagar | AngularJS training in omr | AngularJS training in porur | AngularJS training in tambaram | AngularJS training in velachery
Excellent post. The author has shared the post in a unique way. Have been in a wait for more updates. Do share more. really like this page.
ReplyDeleteAi & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai
Pretty informed post! I'm seeking for some topics I need to see that our site affection and then drove it our site all report is really good. thanks
ReplyDeleteAi & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai
The development of artificial intelligence (AI) has propelled more programming architects, information scientists, and different experts to investigate the plausibility of a vocation in machine learning. Notwithstanding, a few newcomers will in general spotlight a lot on hypothesis and insufficient on commonsense application. machine learning projects for final year In case you will succeed, you have to begin building machine learning projects in the near future.
ReplyDeleteProjects assist you with improving your applied ML skills rapidly while allowing you to investigate an intriguing point. Furthermore, you can include projects into your portfolio, making it simpler to get a vocation, discover cool profession openings, and Final Year Project Centers in Chennai even arrange a more significant compensation.
Data analytics is the study of dissecting crude data so as to make decisions about that data. Data analytics advances and procedures are generally utilized in business ventures to empower associations to settle on progressively Python Training in Chennai educated business choices. In the present worldwide commercial center, it isn't sufficient to assemble data and do the math; you should realize how to apply that data to genuine situations such that will affect conduct. In the program you will initially gain proficiency with the specialized skills, including R and Python dialects most usually utilized in data analytics programming and usage; Python Training in Chennai at that point center around the commonsense application, in view of genuine business issues in a scope of industry segments, for example, wellbeing, promoting and account.
This is the first & best article to make me satisfied by presenting good content. I feel so happy and delighted. Thank you so much for this article.
ReplyDeleteCyber Security Training Course in Chennai | Certification | Cyber Security Online Training Course | Ethical Hacking Training Course in Chennai | Certification | Ethical Hacking Online Training Course | CCNA Training Course in Chennai | Certification | CCNA Online Training Course | RPA Robotic Process Automation Training Course in Chennai | Certification | RPA Training Course Chennai | SEO Training in Chennai | Certification | SEO Online Training Course
With so many books and articles appearing to usher in the field of making money online and further confusing the reader on the real way to make money.
ReplyDeleteBusiness Analytics Course in Bangalore
Big data has made quite an impact on the world and data science has recently risen to be one of the hottest topics. Now how are these two related? data science course syllabus
ReplyDeleteI bookmarked your website because this site contains valuable information. I am very satisfied with the quality and the presentation of the articles. Thank you so much for saving great things. I am very grateful for this site.
ReplyDeleteData Analytics Course in Bangalore
This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the good work. I have been meaning to write something like this on my website and you have given me an idea.
ReplyDeletedata science course in India
You might comment on the order system of the blog. You should chat it's splendid. Your blog audit would swell up your visitors. I was very pleased to find this site.I wanted to thank you for this great read!!
ReplyDeleteArtificial Intelligence Course
Really awesome blog!!! I finally found great post here.I really enjoyed reading this article. Thanks for sharing your innovative ideas to our vision. your writing style is simply awesome with useful information. Very informative, Excellent work! I will get back here. . AWS Course in Chennai
ReplyDeleteI really enjoyed reading your blog. It was very well written and easy to understand. Unlike other blogs that I have read which are actually not very good. Thank you so much!
ReplyDeleteData Science Training in Bangalore
Wonderful blog found to be very impressive to come across such an awesome blog. I should really appreciate the blogger for the efforts they have put in to develop such amazing content for all the curious readers who are very keen on being updated across every corner. Ultimately, this is an awesome experience for the readers. Anyways, thanks a lot and keep sharing the content in the future too.
ReplyDeleteDigital Marketing Training in Bangalore
I will very much appreciate the writer's choice for choosing this excellent article suitable for my topic. Here is a detailed description of the topic of the article that helped me the most.
ReplyDeleteArtificial Intelligence Training in Bangalore
The Extraordinary blog went amazed with the content that they have developed in a very descriptive manner. This type of content surely ensures the participants explore themselves. Hope you deliver the same near the future as well. Gratitude to the blogger for the efforts.
ReplyDeleteMachine Learning Course in Bangalore
scala online training
ReplyDeleteazure devops online training
app v online training
sccm online training
windows admin online training
mysql online training
rastgele görüntülü konuşma - kredi hesaplama - instagram video indir - instagram takipçi satın al - instagram takipçi satın al - tiktok takipçi satın al - instagram takipçi satın al - instagram beğeni satın al - instagram takipçi satın al - instagram takipçi satın al - instagram takipçi satın al - instagram takipçi satın al - binance güvenilir mi - binance güvenilir mi - binance güvenilir mi - binance güvenilir mi - instagram beğeni satın al - instagram beğeni satın al - polen filtresi - google haritalara yer ekleme - btcturk güvenilir mi - binance hesap açma - kuşadası kiralık villa - tiktok izlenme satın al - instagram takipçi satın al - sms onay - paribu sahibi - binance sahibi - btcturk sahibi - paribu ne zaman kuruldu - binance ne zaman kuruldu - btcturk ne zaman kuruldu - youtube izlenme satın al - torrent oyun - google haritalara yer ekleme - altyapısız internet - bedava internet - no deposit bonus forex - erkek spor ayakkabı - webturkey.net - karfiltre.com - tiktok jeton hilesi - tiktok beğeni satın al - microsoft word indir - misli indir
ReplyDeleteThis is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck.
ReplyDeleteReactjs Training in Chennai |
Best Reactjs Training Institute in Chennai |
Reactjs course in Chennai
youtube abone satın al
ReplyDeletecami avizesi
cami avizeleri
avize cami
no deposit bonus forex 2021
takipçi satın al
takipçi satın al
takipçi satın al
takipcialdim.com/tiktok-takipci-satin-al/
instagram beğeni satın al
instagram beğeni satın al
btcturk
tiktok izlenme satın al
sms onay
youtube izlenme satın al
no deposit bonus forex 2021
tiktok jeton hilesi
tiktok beğeni satın al
binance
takipçi satın al
uc satın al
sms onay
sms onay
tiktok takipçi satın al
tiktok beğeni satın al
twitter takipçi satın al
trend topic satın al
youtube abone satın al
instagram beğeni satın al
tiktok beğeni satın al
twitter takipçi satın al
trend topic satın al
youtube abone satın al
takipcialdim.com/instagram-begeni-satin-al/
perde modelleri
instagram takipçi satın al
instagram takipçi satın al
takipçi satın al
instagram takipçi satın al
betboo
marsbahis
sultanbet
takipçi satın al
ReplyDeleteinstagram takipçi satın al
https://www.takipcikenti.com
www.escortsmate.com
ReplyDeleteescortsmate.com
https://www.escortsmate.com
It is late to find this act. At least one should be familiar with the fact that such events exist. I agree with your blog and will come back to inspect it further in the future, so keep your performance going.
ReplyDeleteDigital Marketing Training in Bangalore
A good blog always contains new and exciting information, and reading it I feel like this blog really has all of these qualities that make it a blog.
ReplyDeleteArtificial Intelligence Training in Bangalore
Happy to chat on your blog, I feel like I can't wait to read more reliable posts and think we all want to thank many blog posts to share with us.
ReplyDeleteMachine Learning Course in Bangalore
I wanted to leave a little comment to support you and wish you the best of luck. We wish you the best of luck in all of your blogging endeavors.
ReplyDeleteData Science Training in Bangalore
cover coin hangi borsada
ReplyDeletecover coin hangi borsada
cover coin hangi borsada
xec coin hangi borsada
xec coin hangi borsada
xec coin hangi borsada
ray hangi borsada
tiktok jeton hilesi
tiktok jeton hilesi
Really impressed! Everything is a very open and very clear clarification of the issues. It contains true facts. Your website is very valuable. Thanks for sharing.
ReplyDeleteData Scientist Training in Bangalore
Good blog and absolutely exceptional. You can do a lot better, but I still say it's perfect. Keep doing your best.
ReplyDeleteData Science Training in Nagpur
Informative blog
ReplyDeletebusiness analytics course in agra
tiktok jeton hilesi
ReplyDeletetiktok jeton hilesi
binance referans kimliği
gate güvenilir mi
tiktok jeton hilesi
paribu
btcturk
bitcoin nasıl alınır
very happy to find a good place for many here in the post, the writing is just great, thanks for the post.
ReplyDeleteData Science Course in Ernakulam
Happy to chat on your blog, I feel like I can't wait to read more reliable posts and think we all want to thank many blog posts to share with us.
ReplyDeleteData Science in Bangalore
It would also motivate almost everyone to save this webpage for their favorite helper to help get the look published.
ReplyDeleteData Science Training in Patna
instagram takipçi satın al
ReplyDeletecasino siteleri
G4HVO