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 
  • Samantha73 Profile Picture
    3,378 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 720 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 436 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 409 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans