I need to create related contacts records when pressing the "create contacts" button on the each rows of the datatable. How to create a lightning component for this ..Please help
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
You can use force:createRecord event. This event opens a page to create a record for the specified entityApiName.
Also, note that you cannot use this event in the lightning app, you need to place it on the record page. This event is handled by the one.app container. It’s supported in Lightning Experience, the Salesforce app, and Lightning communities. This event presents a standard page to create a record. That is, it doesn’t respect overrides on the object’s create action.
public class DatatableActionStandardC {
@AuraEnabled
public static List < Account > fetchAccts() {
return [ SELECT Id, Name, Industry, Type FROM Account LIMIT 10 ];
}
}
I need help @Khan Anas On Account Detail Page --> Create a custom button --> Once you click on button it should naviage to lightning Page which will populate all contact associated with that account. (User Lightning data table to show entire list ) .--> there should be three button for each row (View / edit / Delete).
Greetings to you!
Please try the below code, I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
Apex:
Component:
Controller:
CSS:
Application:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
All Answers
Greetings to you!
Please try the below code, I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
Apex:
Component:
Controller:
CSS:
Application:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
Thanks for the help.
Is there a way to just redirect to the new contact standard page when "Create contact" is pressed ?
You can use force:createRecord event. This event opens a page to create a record for the specified entityApiName.
Also, note that you cannot use this event in the lightning app, you need to place it on the record page. This event is handled by the one.app container. It’s supported in Lightning Experience, the Salesforce app, and Lightning communities. This event presents a standard page to create a record. That is, it doesn’t respect overrides on the object’s create action.
https://developer.salesforce.com/docs/component-library/bundle/force:createRecord/documentation
Please try the below code.
Apex:
Component:
Controller:
I hope it helps you.
Kindly mark this as solved if the information was helpful. It will help to keep this community clean.
Regards,
Khan Anas
On Account Detail Page --> Create a custom button --> Once you click on button it should naviage to lightning Page which will populate all contact associated with that account. (User Lightning data table to show entire list ) .--> there should be three button for each row (View / edit / Delete).
Can you please Help me.