Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Apply Check while creating a sales order with EDI

(0) ShareShare
ReportReport
Posted on by 115

Hi all, 

          We have a class which processes sales orders with EDI.  We are tasked with applying a check that if the ordered quantity is less than three, the journal should be converted into sales order and sales order will be cancelled. 

I want to count the total quantity of all the lines of a sales order. Then, compare this quantity with a field in a division/override form.

If the sales order total quantity is exceeding this field's quantity, it should proceed to create the order, else it should convert the journal into sales order which will subsequently be cancelled. How can I do this entire operation ?

  • Jeson Profile Picture
    120 on at
    RE: Apply Check while creating a sales order with EDI

    Lets assume you are using salestable as a data source on the other form.  As what i have understand base on your given info, you can make a class that will calculate the entire quantity of a certain sales order then campare it to the MinQty and place it on the insert or modified field method. Because u want to trigger by qyt righ?

  • Jeson Profile Picture
    120 on at
    RE: Apply Check while creating a sales order with EDI

    In that case, u can place the code on the insert method on the salesline table and also place it on the modified method, if ever ever the quantity will be change to <=3. Just create a class that will update the sales order status.

  • 00030000036294D5 Profile Picture
    115 on at
    RE: Apply Check while creating a sales order with EDI

    One thing more, when the sales order is cancelled, it should be cancelled with a trackable cancellation code. ??

  • 00030000036294D5 Profile Picture
    115 on at
    RE: Apply Check while creating a sales order with EDI

    Suppose we have a sales order named SO-001 with status Journal. It has two lines with each line having quantity 1. I would like to have a sum of quantity of all the lines of this sales order. It will sum as 2 since we have 1 quantity in each line. Now, there is a form which has a table as its datasource. There is a field in that table called MinQty with value as 3.

    I would like to compare my salesorder quantity with this field, and since my sales order quantity is lesser than this field value, I would like to have my sales order cancelled.

  • Surbhi Agrawal Profile Picture
    on at
    RE: Apply Check while creating a sales order with EDI

    If total ordered qty of entire sales order needs to be checked then, the order lines will be created first and then the check should be performed. Is this what you are exactly looking for?

  • 00030000036294D5 Profile Picture
    115 on at
    RE: Apply Check while creating a sales order with EDI

    Trigger by sales line quantity. If sales line quantity is less than or equal to three, the sales order should be cancelled.

  • Jeson Profile Picture
    120 on at
    RE: Apply Check while creating a sales order with EDI

    When it will be cancelled? After closing the form? Or at the end of the day? Or trigger by sales line qty?

  • 00030000036294D5 Profile Picture
    115 on at
    RE: Apply Check while creating a sales order with EDI

    Please help. I want x++ code for counting sum of quantities of all lines of a sales order. Then, I need to compare this value with the value of a field in another table. If sales order quantity exceeds, it will continue to create the order else sales order will be cancelled. Please help...

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... 293,245 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,927 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans