System variables in business central | rec and xrec in bc | bc complete tutorial for all

Поделиться
HTML-код
  • Опубликовано: 9 ноя 2024

Комментарии • 15

  • @konfigurator7268
    @konfigurator7268 Год назад +1

    Thank you very much

  • @mothercensured
    @mothercensured 5 месяцев назад

    Hello Gomathi, thanks for this video! I tried it out and realized that I get the messages when I change the value in any field in the customer card. How would the code look like in the OnModifyRecord trigger if I want to display the message only when changes are made in the Address field?

    • @gomstechtalks
      @gomstechtalks  5 месяцев назад

      the OnModifyRecord trigger can be used to execute custom logic when a record is modified. To display a message only when changes are made in the Address field, you can use the following code
      trigger OnModifyRecord(): Boolean
      var
      RecRef: RecordRef;
      FieldRef: FieldRef;
      OldAddress: Text[100];
      NewAddress: Text[100];
      begin
      // Get the record reference
      RecRef.GetTable(Rec);
      // Get the Address field reference
      FieldRef := RecRef.Field(FieldNo(Address));
      // Get the old and new values of the Address field
      OldAddress := FieldRef.Value;
      RecRef.GetRecord(Rec);
      NewAddress := FieldRef.Value;
      // Check if the Address field value has changed
      if OldAddress NewAddress then begin
      Message('The Address field has been changed.');
      end;
      // Continue with the default behavior of the OnModifyRecord trigger
      exit(true);
      end;

  • @TransferD-h1y
    @TransferD-h1y Год назад +1

    I tried with onclosepage trigger, it is not showing the xRec data. Can you please suggest.

    • @gomstechtalks
      @gomstechtalks  Год назад

      To help you troubleshoot this problem, I would suggest checking the following:
      Ensure that the xRec variable is correctly populated before the page is closed. You can use the Debugger in Business Central to step through your code and verify that the xRec variable contains the expected data.
      Double-check your onclosepage trigger code for any potential errors or conditions that might prevent it from executing as expected. Make sure that you are properly referencing the xRec variable within the trigger.
      Check if there are any conflicting triggers or events that might interfere with the onclosepage trigger. Sometimes, other triggers or events can override the expected behavior.
      Review your page design and layout. Make sure that the xRec data is correctly bound to the page and that the relevant controls are properly configured to display this data.

  • @chirangaranasinghe19
    @chirangaranasinghe19 Год назад +1

    Thank you much much much. Take Care Bye Bye..

  • @MuhammadSaqib-p8t
    @MuhammadSaqib-p8t 10 месяцев назад +1

    mam recxrec is error how it will be removed

    • @gomstechtalks
      @gomstechtalks  10 месяцев назад

      Please share the error message.

    • @MuhammadSaqib-p8t
      @MuhammadSaqib-p8t 10 месяцев назад +1

      @@gomstechtalks The extension object 'recxrec' cannot be declared. Another extension for target 'Customer Card' or the target itself is already declared in this module.

    • @MuhammadSaqib-p8t
      @MuhammadSaqib-p8t 10 месяцев назад +1

      thank you mam this is resolved😄