web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

creating sales order using AL code

(0) ShareShare
ReportReport
Posted on by 90

i created a middleware between business central and shopify and it works perfectly i can create customers and products in both way but the problem is creating sales order, i need to get the customers i added from business central to shopify and assign the relative information of the customer to sales order, but i cant get the customer id in business central, I only have the name, is there any way I can get the customer using Name, I tried setting filter using name but it did not work. 

Example:

I created order in Shopify POS this is the order object https://shopify.dev/api/admin-rest/2021-10/resources/order#resource_object 

when i get this object in AL I cant get the customer id , and when i create sales order i use this code 

                Order.Init();
                Order."No." := '';
                order."Quote No." := Order."No.";
                order."Document Type" := order."Document Type"::Order;
                order.Insert(true);
then i insert other data and modify 
also I need to insert in the lines i use this code in a loop through Shopify object 
                lines.Init();
                lines.SetRange("Document No.", order."No.");
                lines.SetRange("Document Type", order."Document Type");
                lines."Line No." := LineNo(1000);
                lines.Insert(true);
then insert the other data and modify();
can please help me, I can give more details if needed 
I have the same question (0)
  • Samantha73 Profile Picture
    3,297 on at

    You can lookup BC customer by setrange

    Cust.SetRange(Name,ShopifyName);

    If Cust.FindFirst() then

    ..your code

    But I'd store Shopify customer id in BC instead as looking up names is not the best practise

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,821 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,122 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 959 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans