web
You’re offline. This is a read only version of the page.
close
Skip to main content
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 565
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? 
I have the same question (0)
  • Suggested answer
    Greg Kujawa Profile Picture
    565 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. 
  • Verified answer
    YUN ZHU Profile Picture
    95,083 Super User 2025 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
  • Greg Kujawa Profile Picture
    565 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!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,686

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 3,529 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,989 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans