onvalidate trigger in business central | Mandatory fields in bc | Business central complete tutorial

Поділитися
Вставка
  • Опубліковано 1 гру 2024

КОМЕНТАРІ • 32

  • @vishwadeeppal3668
    @vishwadeeppal3668 Рік тому +2

    Your way of explaining was very simple to understand for a fresher !! Subscribing your channel :)

    • @gomstechtalks
      @gomstechtalks  Рік тому

      Glad to hear. Thank you so much for taking the time to appreciate it.
      Regards,
      Dr. Gomathi

  • @gauravSingh-pv6ny
    @gauravSingh-pv6ny Рік тому +1

    thankyu so much ma'am you are very supprting for me thanyou so much heartfully 🙏🙏

  • @prateekdiwan6480
    @prateekdiwan6480 2 роки тому +1

    Please make some videos on APP publishing using the BC Admin shell.

  • @konfigurator7268
    @konfigurator7268 Рік тому +1

    Thank you dear Goms

  • @shabbirworld
    @shabbirworld Рік тому +1

    Mam, There is Field in Customer Card 'Post Code' i want to validate it . User can only Insert Numeric value and length only 6 digit . how can i validate

    • @gomstechtalks
      @gomstechtalks  Рік тому +1

      Try this in the postcode field trigger()
      trigger OnValidate()
      var
      IsNumeric: Boolean;
      begin
      // Check if the Post Code is exactly 6 digits long
      if StrLen("Post Code") 6 then
      Error('The Post Code must be exactly 6 digits long.');
      // Check if the Post Code is numeric
      IsNumeric := true;
      foreach var Char in "Post Code" do
      if not Char.IsDigit() then
      IsNumeric := false;
      if not IsNumeric then
      Error('The Post Code must contain only numeric values.');
      end;
      }

  • @edyzere
    @edyzere Рік тому +1

    Dr. S. Gomathi I want to thank you for wanting to help us with your wonderful videos, they are truly excellent.
    Would you like to help me with a challenge I have with a client? I have to hit an endpoint of an app outside of BC by sending in the request body the values ​​contained in the "Sell-to Customer No." and "No." fields of that same record and a token in the headers when the value in the "Status" field of the Sales Header table (36) changes to "Launched".
    Do you want to help me Dr.? 🙏🏻 Thanks in advance!

    • @gomstechtalks
      @gomstechtalks  Рік тому +2

      Thank you for your kind words and appreciation! I'm glad you find the videos helpful. I'd be happy to assist you with the challenge you're facing.
      To achieve your goal of hitting an endpoint outside of Business Central when the "Status" field of the Sales Header table changes to "Launched," you can leverage the Business Central eventing mechanism.
      1. Create a codeunit: Start by creating a codeunit in Business Central, which will handle the event triggering and API call. You can define a function within the codeunit that listens to the "Status" field changes in the Sales Header table.
      2. Event Subscription: In Business Central, navigate to the Events page and subscribe to the OnAfterModify event of the Sales Header table. Assign your codeunit and function to handle this event.
      3. Implement the API Call: Inside the function, write the code to check if the "Status" field has changed to "Launched." If it has, retrieve the necessary values from the "Sell-to Customer No." and "No." fields of the Sales Header table. Then, use an HTTP library or function within Business Central to make the API call to the desired endpoint outside of Business Central. Ensure that you include the token in the headers and pass the required values in the request body.
      Remember to handle any error scenarios and ensure proper error logging within your codeunit.
      I hope this helps you get started with your challenge! If you need further assistance or have more specific questions, feel free to ask. Good luck with your project!

    • @edyzere
      @edyzere Рік тому +1

      @@gomstechtalks Thank you very much for wanting to help me.
      I already managed to implement the code in AL with your advice and I have two specific questions about an error I have with the token, but I would like to share the code with you. Can I send it to you by any means?
      Thank you very much for wanting to help me.

    • @gomstechtalks
      @gomstechtalks  Рік тому +1

      Yes please mail to gomstechtalks@gmail.com

    • @edyzere
      @edyzere Рік тому

      @@gomstechtalks Dr. Gomathi, I already figured out how to solve the token issue so sending the code may not be necessary. I only have one question left: How do I subscribe to the event when a value changes in the "Status" field and not to the entire record, because now I am subscribed to the event when a value changes in the entire record and then I evaluate the content of that field that is not the most appropriate according to your recommendations.

  • @tahermahmood9360
    @tahermahmood9360 9 місяців тому +1

    Hi Dr. Hope you are fine.
    Please need your suggestion for correct place. i wrote code in page variable.
    This is correct place or not
    field("Applicant Age"; Rec."Applicant Age")
    {
    ApplicationArea = All;
    Caption = 'Applicant age';
    Visible = false;
    trigger OnValidate()
    begin
    if Rec."Applicant Age"

    • @tahermahmood9360
      @tahermahmood9360 9 місяців тому +1

      field("Original Invoice No."; Rec."Original Invoice No.")
      {
      ApplicationArea = All;
      Caption = 'Original Invoice No.';
      NotBlank = true;
      ShowMandatory = true;
      field("Applicant Age"; Rec."Applicant Age")
      {
      ApplicationArea = All;
      Caption = 'Applicant age';
      Visible = false;
      trigger OnValidate()
      begin
      if Rec."Applicant Age"

    • @gomstechtalks
      @gomstechtalks  9 місяців тому

      No, where you have declared/defined "Original Invoice No." and "Reason" ?

    • @tahermahmood9360
      @tahermahmood9360 9 місяців тому

      @tahermahmood9360
      23 hours ago
      Hi
      This is complete code. please need to check below mention code.
      pageextension 50125 Ext_SalesCreditMemo extends "Sales Credit Memo"
      {
      layout
      {
      // Add changes to page layout here
      addafter("Applies-to ID")
      {
      field("Test"; Rec."Test")
      {
      ApplicationArea = All;
      Caption = 'Test';
      NotBlank = true;
      ShowMandatory = true;
      }
      field("Original Invoice No."; Rec."Original Invoice No.")
      {
      ApplicationArea = All;
      Caption = 'Original Invoice No.';
      NotBlank = true;
      ShowMandatory = true;
      }
      field("Reason"; Rec."Reason")
      {
      ApplicationArea = All;
      Caption = 'Reason';
      NotBlank = true;
      ShowMandatory = true;
      }
      }
      }
      actions
      {
      // Add changes to page actions here
      }
      var
      myint: Integer;
      trigger OnInsertRecord(BelowxRec: Boolean): Boolean
      begin
      if Rec."Test" = '' then
      error('Please enter the Test');
      if Rec."Original Invoice No." = '' then
      error('Please enter the Original invoice no.');
      if Rec."Reason" = '' then
      error('Please enter the reason');
      end;
      }

  • @dividuttnamboodiri3283
    @dividuttnamboodiri3283 Рік тому +2

    I have a form in my page I want to show validation error message if any single form field is empty when I click OK button..so what can be done.. show mandatory is working but i have to show on clicking OK button on page.

    • @gomstechtalks
      @gomstechtalks  Рік тому +1

      Write it in the button trigger

    • @dividuttnamboodiri3283
      @dividuttnamboodiri3283 Рік тому +1

      @@gomstechtalks not clear use action trigger which function but ?

    • @gomstechtalks
      @gomstechtalks  Рік тому +1

      In the ok button? Can you send the code to check. ?

    • @dividuttnamboodiri3283
      @dividuttnamboodiri3283 Рік тому +1

      @@gomstechtalks while creating page we get two buttons OK and Cancel, i have applied validation on ontrigger event but when I click on OK button the data are getting saved even it's blank..so while clicking the OK button I want to show validation error message. (Don't have code for this only created page and table fields).so can you help in this?

    • @gomstechtalks
      @gomstechtalks  Рік тому +1

      Please share the table and page code so as to check

  • @HamidIsmail-hf2og
    @HamidIsmail-hf2og Рік тому +1

    Hi Dr. Gomathi, Where to get the source code for this , Employeee source code. I am unable to locate it in your blog. Could you forward the link to me. Thank you very much.

    • @gomstechtalks
      @gomstechtalks  Рік тому

      Please check here github.com/Gomathikrishna/D365-Business-Central-AL-Programming

  • @chirangaranasinghe19
    @chirangaranasinghe19 2 роки тому +1

    thanks. i send a email. but no responce.😕

    • @gomstechtalks
      @gomstechtalks  2 роки тому +1

      Sorry, I didn't see, I am in an official trip. Will check once I am back to the normal routine

    • @chirangaranasinghe19
      @chirangaranasinghe19 2 роки тому

      @@gomstechtalks oh its okay . No problem ..