Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

Programmatically Create a Contact Record Associated with a Customer Record

Posted on by 599
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 599 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 73,333 Super User 2024 Season 2 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 599 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. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,219 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans