You need to sign in to do that
Don't have an account?

Please help me with trigger code
Only One contact should be primary under Account.If user makes other contact as primary then previous one should be made non- primary.Need to store the new and old primary contact value on 2 fields oldContact and newContact on Account.
You could try using the below code and let me know if there are any issues:
Link: http://salesforcemaniacs.blogspot.com/2016/01/primary-contact-trigger-in-salesforce.html
I hope this helps and in case if this comes handy can you please choose this as best answer so that it can be useful for others in the future.
Regards,
Anutej