Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Programmatically Create a Contact Record Associated with a Customer Record

(0) ShareShare
ReportReport
Posted on by 352
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? 
  • Greg Kujawa Profile Picture
    352 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
    81,598 Super User 2025 Season 1 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
    352 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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,190 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,968 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans