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

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Field Validation not working in business central

(1) ShareShare
ReportReport
Posted on by 273
Hi Guys,
I am facing one query . i.e. 
For e.g. I have one field Req.Delivery Date on sales header.& same field on sales line. once i enter data into header field it will automatically populate into sales line field.
I have write this code. code is right as per my assuption, but it is not working.
Once i select the new line ,then it will not updating that value.i want to update this field
I have the same question (0)
  • Verified answer
    YUN ZHU Profile Picture
    94,353 Super User 2025 Season 2 on at
    Field Validation not working in business central
    This is because your code only exists in the OnValidate trigger of Req.Delivery Date field. When you add new Sales Line, the trigger of this field is not executed.
    I think you need to add similar logic in the Sales Line's OnInsert (Table) Trigger. This should solve the problem.
     
    Hope this helps.
    Thanks.
    ZHU
  • Suggested answer
    Judy Profile Picture
    Microsoft Employee on at
    Field Validation not working in business central
    Hi Sir,
     
    It is high recommended that you can troubleshoot in the AL code to identify the root cause of the issue, you can set up break points in the specific lines.
     
    Best Regards,
    Judy
  • Test user Profile Picture
    273 on at
    Field Validation not working in business central
    Hi Yunzhu,
    I have write the same logic on insert trigger on sales line table, but still is not working. Is any other way to do this?
  • Suggested answer
    Robert Jolliffe Profile Picture
    885 on at
    Field Validation not working in business central
    This looks wrong
     

     
    Should be Rec_SalesLine."Req.Delivery Date" as "Req. Delivery Date" is referring to Rec."Req. Delivery Date" 
     
    I think you're setting the header to itself.
  • Suggested answer
    Mohana Yadav Profile Picture
    60,985 Super User 2025 Season 2 on at
    Field Validation not working in business central
    can you share the oninsert code?
  • Test user Profile Picture
    273 on at
    Field Validation not working in business central
    Hi Mohana,
    This is the code i have written on insert trigger on sales line table.
  • Suggested answer
    DevZubair Profile Picture
    4 on at
    Field Validation not working in business central
    use this code on onInsert trigger of sales Line Table and then execute
     
    trigger OnInsert()
    var
    SalesHeader: Record "Sales Header";
    begin
    SalesHeader.Get("Document Type", "Document No.");
    "My Field" := SalesHeader."My Field";
    end;

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,901

#2
YUN ZHU Profile Picture

YUN ZHU 2,079 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 2,041

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans