Skip to main content

Notifications

Announcements

No record found.

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
    2,663 on at
    RE: creating sales order using AL code

    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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February 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... 292,892 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,772 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans