Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Page 5964 "Service Quote" - action(&print) - Trigger OnAction() #28016

Open
1 task done
massnicolas19 opened this issue Jan 29, 2025 · 1 comment
Open
1 task done
Labels
event-request Request for adding an event SCM GitHub request for SCM area

Comments

@massnicolas19
Copy link

massnicolas19 commented Jan 29, 2025

Describe the issue

Hello Team,

We discovered a transaction issue when we try to print a service quote from page 5964 "Service Quote". We also noticed this problem in Page 5900 "Service Order".

We added a custom field of BLOB type. When this field is filled in and then we press on "Print button", we have this error :

Image

We had to create our own custom button and make the standard one invisible temporarily.
You can check in the "Expected behavior" section for a suggested solution.

Thanks in advance for your help.

Expected behavior

Here is the current part of code for the "Print" action :

action("&Print")
{
        ApplicationArea = Service;
        Caption = '&Print';
        Ellipsis = true;
        Image = Print;
        ToolTip = 'Prepare to print the document. A report request window for the document opens where you can specify what to include on the print-out.';

        trigger OnAction()
        var
               ServDocumentPrint: Codeunit "Serv. Document Print";
         begin
               CurrPage.Update(true);
               ServDocumentPrint.PrintServiceHeader(Rec);
         end;
}

The solution we suggest is to add a commit statement after the "CurrPage.Update(true) to close the transaction.

action("&Print")
{
        ApplicationArea = Service;
        Caption = '&Print';
        Ellipsis = true;
        Image = Print;
        ToolTip = 'Prepare to print the document. A report request window for the document opens where you can specify what to include on the print-out.';

        trigger OnAction()
        var
               ServDocumentPrint: Codeunit "Serv. Document Print";
         begin
               CurrPage.Update(true);
               Commit;
               ServDocumentPrint.PrintServiceHeader(Rec);
         end;
}

Steps to reproduce

  1. Add a variable in Page 5964 "Service Quote"
    var
        WorkDescription: Text;
  1. Add a new field in layout section on the same page
field("WorkDescription NSI"; WorkDescription)
{
     ApplicationArea = Basic, Suite;
     MultiLine = true;
     ShowCaption = false;
     ToolTip = 'Specifies the products or service being offered';

     trigger OnValidate()
     begin
             SetWorkDescription(WorkDescription);
     end;
}
  1. Write this procedure an call it in Validate trigger
procedure SetWorkDescription(NewWorkDescription: Text)
    var
        OutStream: OutStream;
    begin
        Clear("Work Description");
        "Work Description".CreateOutStream(OutStream, TEXTENCODING::UTF8);
        OutStream.WriteText(NewWorkDescription);
        Modify();
    end;
  1. Go to a Service Quote Card Page, enter a value in the Work Description Field and try press Print Button

Additional context

No response

I will provide a fix for a bug

  • I will provide a fix for a bug
    Internal work item: AB#563991
@PaulFurlet
Copy link
Contributor

PaulFurlet commented Jan 29, 2025

Why won't you add Commit() in your WorkDescription control OnValidate?

field("WorkDescription NSI"; WorkDescription)
{
     ApplicationArea = Basic, Suite;
     MultiLine = true;
     ShowCaption = false;
     ToolTip = 'Specifies the products or service being offered';

     trigger OnValidate()
     begin
             SetWorkDescription(WorkDescription);
             Commit(); //required for the next Print action call
     end;
}

@AndersLarsenMicrosoft AndersLarsenMicrosoft added event-request Request for adding an event SCM GitHub request for SCM area labels Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event-request Request for adding an event SCM GitHub request for SCM area
Projects
None yet
Development

No branches or pull requests

3 participants