• Steve Fouracre 16
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
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
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