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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Batch job dialog form is opened differently for custom batch jobs and for standard batch jobs

(1) ShareShare
ReportReport
Posted on by 211
Hi Friends,
I tried opening one of the batch jobs from SysAdmin->batch jobs->select a particular batch job->Batch Job History->view tasks->Parameters.
It opens a dialog form.My doubt is for custom batch jobs the records to include section in the dialog form is not included but for standard batch jobs for example create
invoice proposals batch process has the records to include section included in the dialog form.Can you please let me know what is the reason for that as there is a requirement 
from one of our customers to include that section.I have attached screenshots.Thanks.
Standard Batch job dialog form:
 
 
 
Custom Batch job form:
I have the same question (0)
  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at
    This section is used to filter the query used for the report or a batch operation. If your batch uses no such a query, including this section wouldn't make any sense. If you have a query and want to filter it, the reason why the section wasn't added automatically is that you didn't implement it in the right way.
     
    Please give us more information about your batch job so we can give you more concrete advice.
  • Layan Jwei Profile Picture
    8,112 Super User 2025 Season 2 on at
    Hi Badri,
     
    The "records to include" section appears when you use query in your batch. So if there is no query, then it won't appear automatically.
     
    Thanks,
    Layan Jweihan
  • BADRI NARAYANAN G Profile Picture
    211 on at
    Hi Layan and Martin.Thanks for your response.
    Actually there is a query used in this batch job and it is present in the controller and the service class.I have attached screenshot below.
     
    I wanted to highlight one more point i.e when i open the same batch job from the menu item present in project management and accounting module , the records to include section appears but when i open the batch job from SysAdmin->batch jobs->select a particular batch job->Batch Job History->view tasks->Parameters. , the records to include section does not appear.I have attached a screenshot below which shows the records to include section is present when the batch job is opened from project management and accounting module.Please let me know if you need any other details.Thank you.
  • Suggested answer
    Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
    Hi,
     
    Did you add the Query to the contract class as in the below link?
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • BADRI NARAYANAN G Profile Picture
    211 on at
    .Hi Waed Ayyad thanks for your response.
    Yes the Query is added to my contract class just as in the link.But still the records to include section is not showing when i open the batch job from  SysAdmin->batch jobs->select a particular batch job->Batch Job History->view tasks->Parameters.

    Thanks
    Badri
  • Suggested answer
    Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
    Hi Badri,
     
    Try to add this code on your controller.
    public void new()
    {
        super(  classStr(YourServiceClass),
                methodStr(YourServiceClass, processmethodName));
    }

     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    I can see you have put some condition where you need caller datasource record. In sysadmin you don't have the caller record. So I suspect the query code is not triggering. Did you debug if in sysadmin also the mentioned condition is met and query is triggering? Or can you share the full controller class code with us?
  • BADRI NARAYANAN G Profile Picture
    211 on at
    Hi Bharani and Waed.Thanks for your response.
     
    Waed I tried to add the piece of code you gave in controller class , it is still not showing the records to include section when opened from batch job history form.

    Bharani when the batch job is opened from SysAdmin->batch jobs->select a particular batch job->Batch Job History->view tasks->Parameters , the main method in controller class is not triggered.Infact the only method it triggered is the new method in controller class and the postBuild method in the UI Builder class.Query is not written in the new method of controller class.
    Can you please help me with this.
     
    Thank you
    Badri
     
  • Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    Yeah that is what I am saying. Query you are adding or setting in main method which is not getting triggered. So I am asking you to share your code here so that I can suggest.
  • BADRI NARAYANAN G Profile Picture
    211 on at
    Thanks for your response Bharani.
    This is the code present in controller class.I want to specify one more thing that the controller class main method is not called when the batch job is opened from batch job history form.Only method called in controller class is the new method.I will paste the code in controller class.Thanks.
     
    class PMIPBillingScheduleCreateController extends SysOperationServiceController
    {
        public void new()
        {
            super();
            this.parmClassName(classStr(PMIPBillingScheduleCreateService));
            this.parmMethodName(methodStr(PMIPBillingScheduleCreateService, createBillingSchedule));
            this.parmExecutionMode(SysOperationExecutionMode::Synchronous);
        }
     
     
        /// <returns>PMIPBillingScheduleCreateController</returns>
        public static PMIPBillingScheduleCreateController construct()
        {
            PMIPBillingScheduleCreateController controller = new PMIPBillingScheduleCreateController();
            return controller;
        }
     
     
        public static void main(Args _args)
        {
            PMIPBillingScheduleCreateController     controller;
            PMIPBillingScheduleCreateContract       contract;
            Query                                   query;
            PSAParameters                           psaParameters = PSAParameters::find();
            PMIPBillingScheduleTable                billingTable;
            ProjInvoiceProjId    callerProjInvoiceProjId;
            ProjInvoiceTable  projInvoiceTable;
            controller = PMIPBillingScheduleCreateController::construct();
            controller.parmArgs(_args);
            controller.parmLoadFromSysLastValue(true);
            contract = controller.getDataContractObject();
            contract.parmCaller(_args.caller());
            contract.parmAllowToDuplicateBillingPeriod(false);
            if(psaParameters.PMIPActivateBillingSchedule == NoYes::No)
            {
                throw Global::warning("@AXP:AXP3307");
            }
            if (_args)
            {
                if (_args.dataset() == tableNum(PMIPBillingScheduleTable))
                {
                    billingTable = _args.record();
                    callerProjInvoiceProjId = billingTable.ProjInvoiceProjId;
                }
                else if (_args.dataset() == tableNum(ProjInvoiceTable))
                {
                    projInvoiceTable = _args.record();
                    callerProjInvoiceProjId = projInvoiceTable.ProjInvoiceProjId;
                }
                else
                {
                    query = new Query(queryStr(PMIPContractBillingFrequencyQuery));
                    contract.setQuery(query);
                }
                if (callerProjInvoiceProjId)
                {
                    query = new Query(queryStr(PMIPContractBillingFrequencyQuery));
                    QueryBuildDataSource qbds  = query.dataSourceTable(tableNum(PMIPContractBillingFrequency));
                    SysQuery::findOrCreateRange(qbds,fieldNum(PMIPContractBillingFrequency,ProjInvoiceProjId )).value(callerProjInvoiceProjId);
                    contract.setQuery(query);
                }
            }
            controller.startOperation();
            controller.refreshCallingForm(_args);
        }
     
     
        private void refreshCallingForm(args _args)
        {
        
            FormRun callerForm = _args.caller();
            if (callerForm)
            {
                if (callerForm.name() == formStr(PMIPBillingScheduleListPage) || callerform.name() == formStr(PMIPBillingSchedule))
                {
                    callerForm.refreshForm();
                }
            }
        }
    }

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans