+ Start a Discussion
chandrashekar Jangitichandrashekar Jangiti 

How we can pre-populate values while creating record in lightning component page...

Hi Code player's..

Iam new to Lightning and i have one query "How we can pre-populate values while creating record in lightning component page..." please help with some example codes...


Thanks,
Chandu
SandhyaSandhya (Salesforce Developers) 
Hi,

You can use force:createRecord 
The defaultFieldValues attribute lets you prepopulate the create record form with default or calculated field values. Prepopulated values can accelerate data entry, improve data consistency, and otherwise make the process of creating a record easier. Specify default field values as name-value pairs in a JavaScript object.

Refer below linkl which has sample code for the same.
https://albasfdc.com/2018/03/19/creating-pre-populated-records-with-lightningrecordeditform/
 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
                                             
Best Regards
Sandhya
 
 
chandrashekar Jangitichandrashekar Jangiti
Hi Sandhya..

Thanks for quick reply, And also majorly am looking Lookup fields like Account,Contact and Opportunity need to prepopulate so is this code helpfull for me?.

Thanks,
Chandu
Ajay K DubediAjay K Dubedi
Hi Chandrashekar,

please refer to the below links.

1. https://developer.salesforce.com/forums/?id=9060G000000UYc0QAG

2. http://writeforce.blogspot.com/2012/12/prepopulating-fields-using-URL-hacking.html


Let me know if it helps you.

Thank You,
Ajay Dubedi
chandrashekar Jangitichandrashekar Jangiti
Hi Ajay,
Thanks for reply..but am looking for in lightning page..and that second link is not working it is showing blank page..

thanks,
Chandu
Ajay K DubediAjay K Dubedi
Hi Chandrashekar,

please use this: http://writeforce.blogspot.com/2012/12/prepopulating-fields-using-url-hacking.html

Thank You,
Ajay Dubedi
chandrashekar Jangitichandrashekar Jangiti
Hi Ajay,

thanks for helping , but am expecting in lightning component...please do help with lightning component and controller(force:Createrecord)..but am not able to find exact in component so...


thanks,
Chandu
chandrashekar Jangitichandrashekar Jangiti
Hi  @Sandya,

It is not working for me which you shared code link...Could you help me with possible ways with prepopulating values of Account,Contact and Opportunity..


Thanks,
Chandu