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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

Create Job Sales Invoice using a custom option resource no in request page

(4) ShareShare
ReportReport
Posted on by 48
I have added a Resource No. option to the request page of Job Create Sales Invoice and upon selecting that option the sales invoice should be created only for the selected resource no. 

reportextension 50208 "Job Create Sales Invoice Ext" extends "Job Create Sales Invoice"
{
requestpage
{
layout
{
addafter(Options)
{
field("Resource No"; Resource."No.")
{
ApplicationArea = All;
Caption = 'Resource No.';
TableRelation = Resource."No.";
}
}
}
}

var
Resource: Record Resource;

}


can we subscribe to "OnBeforeCreateNewInvoice" event to achieve this?
I have the same question (0)
  • Suggested answer
    Sohail Ahmed Profile Picture
    11,177 Super User 2026 Season 1 on at
    Yes, you can subscribe to the OnBeforeCreateNewInvoice event to apply custom filtering logic before the invoice is created. However, the Job Create Sales Invoice report processes multiple job planning lines, so you’ll need to filter the relevant records (like Job Planning Line) based on the selected Resource No. before the invoice is generated.
     
    Here’s a high-level approach:
     
    1. Add Resource No. to request page – already done in your reportextension.
     
     
    2. Use a global variable to store the selected Resource No.
     
     
    3. Subscribe to OnBeforeCreateNewInvoice event and filter Job Planning Line or related data using the selected Resource No.
     
     
     
    You may also need to handle filtering in earlier processing steps if planning lines are already loaded before the event is raised. In such cases, consider subscribing to earlier events or filtering the dataset manually.
     
    For deeper help, feel free to check out my tips here: https://www.linkedin.com/in/sohailahmad897
     
     
    Mark below checkbox to make this answer Verified if it helps you. ✅
     
     
  • Suggested answer
    DAnny3211 Profile Picture
    11,423 Super User 2026 Season 1 on at

    Hi Syed,

    You've made a great start by adding the Resource No. field to the request page. To ensure that the sales invoice is created only for the selected resource, you'll need to filter the data in the report's dataset based on the selected Resource No.

    Here’s what you can do next:

    1. Add a variable to store the selected Resource No. in the report extension.
    2. Apply a filter to the dataset (e.g., Job Planning Lines or Job Ledger Entries) using the selected Resource No.
    3. Modify the logic in the report's OnPreDataItem or OnAfterGetRecord triggers to respect the filter.

    Example snippet to apply the filter:

     

    JobPlanningLine.SetRange("Resource No.", Resource."No.");

    Make sure this filtering is applied before the invoice creation logic runs.

    Let me know if you need help integrating this into your report extension!

    Please verify if this response was helpful.

    Best regards!

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,496 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 961 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 870 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans