Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Put a newly created or...
Finance forum
Suggested answer

Put a newly created or modified sales order on hold via code

Posted on by 5
Hi ,
 
I'm new to D365 F&O x++ development & customization.
I have a requirement below:
 
Need to put newly created sales order or modified sales order on hold .
1. If order receipt date is changed or new sales line is added by clicking on save the logic to put order on hold will run.
2. Logic will be decided via lead time & requested receipt date
          If requested receipt date - order created date < lead time then put order on hold otherwise order can be processed further like confirmation & packing slip.
Lead time setup will be defied separately based on customer group & released product via extension.
 
Can you please tell me where i can write the x++ logic put order on hold & the some x++ code sample if possible ?
 
Thank you.
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 287,773 Super User on at
    Put a newly created or modified sales order on hold via code
    Hi,

    I thought I replied earlier to your question, but apparently, the details were not saved. Can you clarify if every time both conditions should be met together or are these two separate checks to be implemented? 

    Note that a user is not required to click the save button for storing changes in the database. When moving to another record or when the user closes the form, in 99% of the cases the details are automatically saved. Usually code for changing field values based on changes is done in a modifiedField() method and changes during creation or updating the record are to be developed on the insert() and update() methods.
  • CU20061756-0 Profile Picture
    CU20061756-0 5 on at
    Put a newly created or modified sales order on hold via code
    Hi Waed,
    Thanks for your reply.
    I'm still working on the issue  
  • Waed Ayyad Profile Picture
    Waed Ayyad 3,711 on at
    Put a newly created or modified sales order on hold via code
    Hi,

    Is your issue resolved?  

    Thanks
    Waed Ayyad
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 3,711 on at
    Put a newly created or modified sales order on hold via code
    Hi,
     
     Let us simplify the requirement. You can start by adding a new method on the have the logic (to check if the order should be put on hold or not). Your new method will return Boolean.


    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
    ​​​​​​​

     
  • Waed Ayyad Profile Picture
    Waed Ayyad 3,711 on at
    Put a newly created or modified sales order on hold via code
    Hi
     
     

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,773 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,513 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans