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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / how to write sales ord...
Power Apps
Unanswered

how to write sales order to business central from power apps

(0) ShareShare
ReportReport
Posted on by 14

so i have a collection of customer shopping cart that include item number, quantity, Screenshot (24).png

and i want to create sales order everytime user click on check out button. can someone tell me how to do so?

what i did was using patch(salesorderline, defaults(salesorderline),{productid:,quantity:,customerid:}) but it shows error saying that i need documentid which i dont know what's the document id is.

 

Categories:
I have the same question (0)
  • v-jefferni Profile Picture
    on at

    Hi @mbc1998 ,

     

    Could you please share the details of your data source? Where is the "salsorderline" table?

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Scott Hudson Profile Picture
    2 on at

    Did you figure this out?   I am curious as I am trying to patch to a sales order in BC as well and having some difficulty.  I can say that you most likely need to patch the sales order first, then add the sales order lines but I am getting an error just trying to create sales order. 

     

    The id is most likely the 'number' in BC, generally the sales order number in BC.

  • Santiago270500 Profile Picture
    10 on at

    Via PowerAutomate you can use run action triggered by a button in Powerapps this is the code I used for the patch

    Set(vDocument, DataCardValue70_1.Text);
    If(
    Trim(vRespNumber) = "",
    IfError(
    UpdateContext(
    {
    respuesta: Patch(
    'salesQuotes (v2.0)_1',
    Defaults('salesQuotes (v2.0)_1'),
    {
    'Customer No.': ComboBoxCustomer_1.Selected.'No.',
    'External Document No.': DataCardValue70_1.Text,
    Salesperson: ComboBoxVendedor_1.Selected.'Código del vendedor'
    }
    )
    }
    ),
    Set(
    vRespId,
    respuesta.Id
    ),
    Set(
    vRespNumber,
    respuesta.'No.'
    ),
    Notify(FirstError.Message)

    )
    );
    Set(
    vRespId,
    LookUp(
    'salesQuotes (v2.0)_1',
    'No.' = vRespNumber
    ).Id
    );
    IfError(
    UpdateContext(
    {
    respuestaDet: Patch(
    'salesQuoteLines (v2.0)_1',
    Defaults('salesQuoteLines (v2.0)_1'),
    {
    Sequence: gNumLinea,
    //'Item Id':Items.Selected.Id,
    'Item Id': ComboBoxItems_1.Selected.Id,
    'Document Id': vRespId,
    Quantity: vQty
    }
    )
    }
    ),
    Notify(FirstError.Message)
    );
    Set(
    gNumLinea,
    gNumLinea + 10000
    );

    After that i used a powerautomate flow to do the Sales Invoice with the run action and a second flow for the Posted Sales Invoice

  • Taneem Profile Picture
    5 on at

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard