You need to sign in to do that
Don't have an account?
Steve Fouracre 16
Link Account and Contact
Im pretty sure you can do this and I think Ive done before but I can t exactly remember how.
I want to link Account and Contact together but I dont know the Id of the Account. Similarly to how Workbench uses Smart Lookup I want to eneter the Name of the Account and the DML does the rest to link the 2 objects
So it would be something like
Contact c = new Contact (Firstname='Steve', Lastname='Hendry', AccountId='36 Robinsmith Rd');
insert c ;
As you see Ive not provided the Id for the AccountId but so long as the Account '36 Robinsmith Rd' exists I want them to link
I want to link Account and Contact together but I dont know the Id of the Account. Similarly to how Workbench uses Smart Lookup I want to eneter the Name of the Account and the DML does the rest to link the 2 objects
So it would be something like
Contact c = new Contact (Firstname='Steve', Lastname='Hendry', AccountId='36 Robinsmith Rd');
insert c ;
As you see Ive not provided the Id for the AccountId but so long as the Account '36 Robinsmith Rd' exists I want them to link
You can do this if you use an external ID field on Account to associate it with. The external ID works good if its unique.
Hope this helps!
Santosh
You cant do that because the Account on the Contact is already a standard field
Steve
This is what i mean when I say external ID field.
1. Create an unique external ID field on account
2. Associated that to a contact
Hope this helps! If its does, kindly mark this as the solution.