Skip to main content

Notifications

Announcements

No record found.

Supply chain | Supply Chain Management, Commerce
Suggested answer

Sales order custom field mandatory only working when we edit Sales order form

(2) ShareShare
ReportReport
Posted on by 1,950
Hi Experts,
 
I have created two customer fields with mandatory. Customer Mobile Number and Address. When we edit Sales order then mandatory is working. In our business scenario Sales order is created from Sales agreement. Once Sales order created, user print sales order confirmation without editing sales order. I want to validate Customer Mobile Number and Address fields whenever user click on sales order confirmation to force them to enter information in Customer Mobile Number and Address fields.
 
Please help me how to do it.
 
 
Without Edit
 
With Edit
 
 
Thanks,
Faiz
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 11,759 Super User 2024 Season 2 on at
    Sales order custom field mandatory only working when we edit Sales order form
     
     
    I suggest two solutions:

    1. disable the menu item's “confirm” button if these fields are not filled in, otherwise enable it (x++ code on fprm class extension).
     
    2. in the “SalesFormLetter” class, check that the fields are not filled in, then close the dialog with an error message.
     
    Best regards,
    Mohamed Amine MAHMOUDI
     
  • faiz7049 Profile Picture
    faiz7049 1,950 on at
    Sales order custom field mandatory only working when we edit Sales order form
    Hi Experts,
     
    Please guide me.
     
    Thanks,
    Faiz
     
     
  • faiz7049 Profile Picture
    faiz7049 1,950 on at
    Sales order custom field mandatory only working when we edit Sales order form
    Hi Amine,
     
    Thank you for reply. I should go with SalesFormLetter class because modifying enable property in menu item without user notify what they have to do . They will complaint.
     
    Could you please tell me in SalesFormLetter class where should I check.
     
    Thanks,
    Faiz
     
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 11,759 Super User 2024 Season 2 on at
    Sales order custom field mandatory only working when we edit Sales order form
     
    I think you need to intervene in the SalesFomLetter class or modify the enable property of menu item when the condition is correct.
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • faiz7049 Profile Picture
    faiz7049 1,950 on at
    Sales order custom field mandatory only working when we edit Sales order form
    Hi Experts,
     
    Could you please guide me.
     
    Thanks,
    Faiz
  • faiz7049 Profile Picture
    faiz7049 1,950 on at
    Sales order custom field mandatory only working when we edit Sales order form
    Hi Amine,
     
    On form datasource because I do not want to interrupt old Sales Order. I try click method it throw error but sales confirmation still got open.
     
    Also this thread Only store numeric values in field . I tried many time check box verified by still not updating.
     
        [FormControlEventHandler(formControlStr(SalesTable, buttonUpdateConfirmation), FormControlEventType::Clicked)]
        public static void buttonUpdateConfirmation_OnClicked(FormControl sender, FormControlEventArgs e)
        {
            FormRun formRun = sender.formRun();
            FormDataSource salesTableDS = formRun.dataSource(tableStr(SalesTable));
          
            SalesTable salesTable = salesTableDS.cursor() as SalesTable;
            
            if (salesTable.SFACustAddress == '' || salesTable.SFAMobileNumber == '')
            {
                throw error("Both Customer Mobile Number and Address fields must be filled before confirmation.");
               
            }
            
    
        }
     
     
    Thank you
    Faiz
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 11,759 Super User 2024 Season 2 on at
    Sales order custom field mandatory only working when we edit Sales order form
     
    I'd like to know if you make it mandatory for the table or the form datasource ?
     
    BR
    Mohamed Amine MAHMOUDI

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,897 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,573 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans