You need to sign in to do that
Don't have an account?
Arnas Baronas
Override a button using lightning component in Salesforce
Hello,
What I'm trying to do is to recreate the "New" button in custom object's list views. The only difference between the existing standard "New" and the one I'm trying to create is that so I could control which recordtypes to show and which to hide. I have tried creating it myself and searching for similar codes but no luck... I currently am a beginner to salesforce lightning components and would appreciate some help from more experienced developers.
What I'm trying to do is to recreate the "New" button in custom object's list views. The only difference between the existing standard "New" and the one I'm trying to create is that so I could control which recordtypes to show and which to hide. I have tried creating it myself and searching for similar codes but no luck... I currently am a beginner to salesforce lightning components and would appreciate some help from more experienced developers.
I have some questions for your requirements:
- Are you able to create a new button/link with lightning component?
- On what conditions you want to show/hide the record types?
I can help if you can answer these questions and provide some more details.Thanks,
Abhishek Bansal.
Thank you for commenting.
- I do know how to create a new button with lightning component but I'm not familliar with creating links using lightning components.
- There are really no conditions for hiding the record types, my custom object just has too many record types that are used for creating records ONLY by launching a flow and need to be hidden in the record type selection screen when you press the "New" button in the List Views.
I'm trying to use a SELECT query to get the record types by name in the lightning component so that in the future if I create a new record type that needs to be visible, I could just easily add the name in the SELECT query and it would show in the radio group.If you want to hide the record type selection screen, than it can be easily done while overriding the New button. Please see the attached screenshot:
You can check the checkbox "Skip Record Type Selection page". Let me know if you need any further information on this.
Thanks,
Abhishek Bansal.
I still do need the record type selection screen. I'll try to be more clearly, in my custom object I overall have 22 record types and 17 of them are used to create records ONLY by pressing a action button that launches a flow, the other 5 need to stay as a selection to what type of record I can create when pressing the "New" button in the object's list view.
That means you want to show only 5 record type during the selection? You can take help from the link given below:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_Schema_RecordTypeInfo.htm
You can also reach out to me for any further help:
Gmail: abhibansal2790@gmail.com
Skype: abhishek.bansal2790.
Thanks,
Abhishek Bansal.