Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

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

Posted on by 161
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:
  • BADRI NARAYANAN G Profile Picture
    BADRI NARAYANAN G 161 on at
    Batch job dialog form is opened differently for custom batch jobs and for standard batch jobs
    Hi Bharani.

    Go to SysAdmin->Enquiries->Batch jobs->select the batch job which you just ran->Batch job history on the top->View Tasks->Parameters.
     
    Thank you
    Badri.
  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,590 Super User 2024 Season 1 on at
    Batch job dialog form is opened differently for custom batch jobs and for standard batch jobs
    Can you tell me how you are opening this batch from Sys Admin?
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 5,955 Super User 2024 Season 2 on at
    Batch job dialog form is opened differently for custom batch jobs and for standard batch jobs
    Hi,
     
    Try to set Contract Query without any condition and check if the Records to include appears or not?
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • BADRI NARAYANAN G Profile Picture
    BADRI NARAYANAN G 161 on at
    Batch job dialog form is opened differently for custom batch jobs and for standard batch jobs
    Hi Bharani and Martin.Thanks for your response.
     
    I did try to set the query in the UI Builder class just like the way they did in contract class , it is still not working.

    Seems like when the batch job is implemented through SysOperation Framework the batch job viewed from batch job history form does not include the "records to include" section.
     
    I also noticed that when the batch job is implemented through the older framework i.e RunnableBatch the query is getting set and the "records to include" section is shown in the batch job dialog form when it is viewed from SysAdmin->batch jobs->select a particular batch job->Batch Job History->view tasks->Parameters.

    I also checked the standard batch process which is implemented using the newer framework i.e through SysOperation , then in that case as well the "records to include" section is not shown.It looks like a standard issue.

     
    If there is any solution on this please let me know.
     
    Thank you
    Badri.
  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,590 Super User 2024 Season 1 on at
    Batch job dialog form is opened differently for custom batch jobs and for standard batch jobs
    Ideally if you get and set query(method returning packedquery) in the contract irrespective of caller it should come. As it is not coming and you need to implicitly set, you can try setting the query in the ui builder like how you set other contract parameters. Try this and let me know if this works.
  • Martin Dráb Profile Picture
    Martin Dráb 229,275 Most Valuable Professional on at
    Batch job dialog form is opened differently for custom batch jobs and for standard batch jobs
    The constructor (new()) creates an instance of the controller. Creating a second instance there makes no sense to me. You want to work with the object created by the batch framework, not by another instance created by yourself.
     
    There is no buffer of the controller class, because it's not a table. But you can access the current instance of the controller by the variable called this, which you aren't actually already doing in new() (e.g. this.parmClassName()), despite of saying that you can't).
     
    Neverteless trying to work with the contract already in the constructor sounds wrong to me.
  • BADRI NARAYANAN G Profile Picture
    BADRI NARAYANAN G 161 on at
    Batch job dialog form is opened differently for custom batch jobs and for standard batch jobs
    Hi Bharani.Thanks for your response.
    When we open the batch job from batch job history form the only method accessible in the controller class is the new method.In the new method i am not able to get the buffer of controller class due to which i cannot create a buffer for contract class.I did try to set the query in new method of controller class but i was not able to do it.I have attached screenshot below.It goes in a infinite loop with the new method if i try to create a buffer for controller class in new method.Please let me know if there is any solution for this.Thanks.
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,590 Super User 2024 Season 1 on at
    Batch job dialog form is opened differently for custom batch jobs and for standard batch jobs
    In your contract class you have just made the skeleton of query which is called from your controller which means query is getting created in your controller main method only. So, try creating the query without the condition. I mean to initialize the query without any ranges. As you have put set and get query which means you need to initialise it. Otherwise it wont come. So as running from batch directly just create query without adding any range.
  • BADRI NARAYANAN G Profile Picture
    BADRI NARAYANAN G 161 on at
    Batch job dialog form is opened differently for custom batch jobs and for standard batch jobs
    Hey Martin.I will share the contract class code and UI Builder class code.Thank you.
     
    Contract class : 
    [
        DataContractAttribute,
        SysOperationContractProcessingAttribute(classStr(PMIPBillingScheduleCreateUIBuilder))
    ]
    class PMIPBillingScheduleCreateContract
    {
        str         packedQuery;
        int         daysInAdvance;
        TransDate   processDate;
        boolean     autoCreatePrebillingSummary,allowToDuplicateBillingPeriod;
        Object      caller;
        [
            DataMemberAttribute('ProcessDate'),
            SysOperationLabel(literalStr("Process date")),
            SysOperationDisplayOrderAttribute('3')
        ]
        public TransDate parmProcessDate(TransDate _processdate = processDate)
        {
            processDate = _processdate;
            return processDate;
        }
        [
            DataMemberAttribute('AutoCreatePrebillingSummary'),
            SysOperationLabel(literalStr("@AXP:AXP4165")),
            SysOperationDisplayOrderAttribute('4')
        ]
        public boolean parmIncludePreBillingSummary(boolean _autoCreatePrebillingSummary = autoCreatePrebillingSummary)
        {
            autoCreatePrebillingSummary = _autoCreatePrebillingSummary;
            return autoCreatePrebillingSummary;
        }
        [
            DataMemberAttribute('AllowToDuplicateBillingPeriod'),
            SysOperationLabel(literalStr("@AXP:AXP4167")),
            SysOperationDisplayOrderAttribute('2')
        ]
        public boolean parmAllowToDuplicateBillingPeriod(boolean _allowToDuplicateBillingPeriod = allowToDuplicateBillingPeriod)
        {
            allowToDuplicateBillingPeriod = _allowToDuplicateBillingPeriod;
            return allowToDuplicateBillingPeriod;
        }
        [
            DataMemberAttribute('DaysInAdvance'),
            SysOperationLabel(literalStr("Days in Advance")),
            SysOperationDisplayOrderAttribute('1')
        ]
        public int parmDaysInAdvance(int _daysInAdvance = daysInAdvance)
        {
            daysInAdvance = _daysInAdvance;
            return daysInAdvance;
        }
        [
            DataMemberAttribute,
            AifQueryTypeAttribute('_packedQuery', queryStr(PMIPContractBillingFrequencyQuery))
        ]
        public str parmPackedQuery(str _packedQuery = packedQuery)
        {
            packedQuery = _packedQuery;
            return packedQuery;
        }
        public Query getQuery()
        {
            return new Query(SysOperationHelper::base64Decode(packedQuery));
        }
        public void setQuery(Query _query)
        {
            packedQuery = SysOperationHelper::base64Encode(_query.pack());
        }
        [
            DataContractAttribute('Caller'),
            SysOperationLabel(literalStr("Caller Form"))
        ]    
        public Object parmCaller(Object _caller = caller)
        {
            caller = _caller;
            return caller;
        }
    }
     
    UIBuilder Class Code:
    class PMIPBillingScheduleCreateUIBuilder extends SysOperationAutomaticUIBuilder
    {
        DialogField processDate, daysInAdvance;
        DialogField autoCreatePreBillingSummary;
        /// <summary>
        /// “Process date” (date). Defaulted as today’s date.
        ///“Days in advance” (integer). Defaulted as zero.
        /// </summary>
        public void postBuild()
        {
            PMIPBillingScheduleCreateContract contract = this.dataContractObject();
            super();
            processDate =   this.bindInfo().getDialogField(contract, methodStr(PMIPBillingScheduleCreateContract, parmProcessDate));
            daysInAdvance = this .bindInfo().getDialogField(contract, methodStr(PMIPBillingScheduleCreateContract, parmDaysInAdvance));
            daysInAdvance.value(0);
            autoCreatePreBillingSummary = this .bindInfo().getDialogField(contract, methodStr(PMIPBillingScheduleCreateContract, parmIncludePreBillingSummary));
            autoCreatePreBillingSummary.visible(PSAParameters::find().PMIPActivatePreBillingSummary);
            processDate.value(DateTimeUtil::getToday(DateTimeUtil::getUserPreferredTimeZone()));
        }
    }
  • Martin Dráb Profile Picture
    Martin Dráb 229,275 Most Valuable Professional on at
    Batch job dialog form is opened differently for custom batch jobs and for standard batch jobs
    Please show us the contract class too.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,900 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,275 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans