Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Answered

Programmatically Create a Contact Record Associated with a Customer Record

Posted on by 573
Using BC 365 SaaS v23, and have Marketing Setup for new customers having a business relation to automatically create new contacts. So if I go into the BC 365 SaaS web UI and create a new customer record then I indeed see the new contact record created that's linked to that new customer record. All good there.
 
What I'm looking to do is implement this same mechanism through an AL codeunit. I already have working AL codeunit procedures that create a new contact record, as well as a new customer record. Of course there is no relation between them. But is there an AL codeunit procedure I can invoke in the base app that will automatically observe the same behavior mentioned in the web UI scenario above? 
Categories:
  • Greg Kujawa Profile Picture
    Greg Kujawa 573 on at
    Programmatically Create a Contact Record Associated with a Customer Record
    Yep, that's exactly what I went to. All is working well now. Fits our needs perfectly. The whole idea behind this is that out of the box BC 365 doesn't perform thorough validation of someone's contact information. So I have an external web form that verifies the mailing address, validates the phone number, validates the e-mail address all against third party API services. So only then when the user submits does the new customer (and linked contact) record get created. Thanks for the prompt reply and insight!
  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 64,563 Super User on at
    Programmatically Create a Contact Record Associated with a Customer Record
    Hi, The key is the table below, so you can try again.
     
     
    Hope this helps.
    Thanks.
    ZHU
  • Suggested answer
    Greg Kujawa Profile Picture
    Greg Kujawa 573 on at
    Programmatically Create a Contact Record Associated with a Customer Record
    Actually I can step through the process programmatically using three separate custom AL codeunit procedure calls. First I create the new customer record, next I create the new contact record (based on the info in the customer record), and finally I create the contact business relation between the two. All fine. 

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,584 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,864 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans