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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Answered

Automatic processing of delay days - salesCalcAvailableDlvDates class

(0) ShareShare
ReportReport
Posted on by 230

Good morning all!

We have the requirement to automatically process/push masterplanning delay days to our sales orders.

To accomplish this I have made a class that checks the ReqTrans table, takes the futuredate (that is the date that the Masterplanning calculates as the first possible delivery date) and updates the salesline confirmed shipdate.

This goes well, however... it doesn't automatically update the confirmed receipt date. Only the confirmed ship date is updated. 

Because of calendars (customer calendars, warehouse calandars etc.) and transport days, it is not as simple as using the same date as the confirmed ship date. Therefore I call the 'normal' modified field logic:

 try
                                {
                                    ttsbegin;
                                    
                                    updateSalesline.ShippingDateConfirmed = salesLineToDate;
                                    updateSalesline.modifiedFieldDDC(fieldNum(SalesLine, ShippingDateConfirmed), false);
                                    updatesalesline.update();
                                    
                                    ttscommit;
                                    delaysPushed  ;
                                }

I give the parameter 'false' to the modifiedfieldDCC, to let the method know that it is not ok to give the user UI-interaction. However, when I run the code and a calendar issue occurs, it pops up the User interface after all:

pastedimage1639823424319v1.png

When I try to update I get a unbalance in TTS because I am in an update action and try to do another one.

What am I missing here? I am giving the 'False' variable to the modifiedfield method, however it seems that it is being ignored. I see in the table  method that the boolean is always set to true:

 /// 
    /// Processes the modified field event for delivery date control fields.
    /// 
    /// 
    /// The field ID for the modified field.
    /// 
    /// 
    /// Controls whether UI interactions with the user are allowed.
    /// 
    public void modifiedFieldDDC(FieldId _fieldId, boolean _uiEnabled = true) //Enhanced Delivery Date Control
    {


Does anyone know how to approach this?

Thank you very much for your help.

Willem.

I have the same question (0)
  • Verified answer
    Willem van Duren Profile Picture
    230 on at

    Update:

    I saw that the shipdate is triggering the user interface, not the receipt date. Therefore I added some logic that checks if the calendar is open on the date the masterplanning calculated, and if not add 1 working day according to the calendar. That seems to do the trick:

    //Added: Check if shipdate is valid
                            CompanyInfo         localcompanyinfo;
                            
                            select firstonly localcompanyinfo where localcompanyinfo.DataArea==curExt();
    
                            CalendarId          calendarId  =   localcompanyinfo.ShippingCalendarId;
                            
                            if(calendarId=="")
                            {
                                Error("No shipping calendar is filled in [Organization administration > Organizations > Legal Entity, Contact your system administrator.");
                            }
                            
                            else
                            {
                                boolean isDateOpen = true;
                                isDateOpen = new WorkCalendarSched(false).isDateOpen(calendarId, salesLineToDate);
    
                                if(!isDateOpen)
                                {
                                    date datehelper = new WorkCalendarSched(false).schedDate(SchedDirection::Forward,  salesLineToDate, 1, true, CalendarId);
                                    saleslinetoDate = datehelper;
                                }
                            }
                            //End: calendar


    It seems a good night sleep does the trick sometimes ;-)

  • huijij Profile Picture
    19,811 on at

    Hi Willem,

    Glad to hear that.I will help to verify the answer has closed the thread.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
Laurens vd Tang Profile Picture

Laurens vd Tang 299 Super User 2025 Season 2

#2
Siv Sagar Profile Picture

Siv Sagar 183 Super User 2025 Season 2

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 118 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans